The only thing we have to add is
if ( !( obj instanceof AccessibleObjectDescriptor ) )
{
return false;
}
That will make AccessibleObjectDescritpor.equals() obey to the general
contract of equals (which states, that x.equals(null) has to return
false) and it will fix the FindBugs issue, which will have to be fixed
anyway, if BeanUtils2 leaves Sandbox and gets released someday (at least
I hope that FindBugs understands, that null instanceof WhatEver returns
false).
I see no reason to write less robust code, just because it is internal
to the library and saves us a few lines.
Am 01.03.2012 15:49, schrieb Simone Tripodi:
AccessibleObjectRegistry.AccessibleObjectDescriptor is used internally
only, users don't even know that it exist and it is used only as a key
for the AccessibleObject index.
Does it make sense checking other types, nulls, assignability from
super/subclasses, ... etc?
http://people.apache.org/~simonetripodi/
http://simonetripodi.livejournal.com/
http://twitter.com/simonetripodi
http://www.99soft.org/
On Thu, Mar 1, 2012 at 3:09 PM, Benedikt Ritter
<b...@systemoutprintln.de> wrote:
Hi,
I just ran the eclipse FindBugs plugin with default configuration on
BeanUtils2 and it pointed me to equals() in
AccessibleObjectRegistry.AccessibleObjectDescriptor, reporting that the cast
in line 535
AccessibleObjectDescriptor other = (AccessibleObjectDescriptor) obj;
is not checked for null.
Now I'd like to implement equals() like it is shown in Effective Java. Are
there any arguments against changing the implementation that way?
Regards,
Benedikt
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org