4069 - A couple inspection oddities


See attached pictures.

There is an inspection "Object.equals(null)". For some reason it's flagging several places in my code,even though the parameter to equals is not null. Is this a new inspection? I don't remember seeing it before.

Also, some of my classes are getting flagged "Instance variable of concrete class Foo". I thought this was only flagging instances of concrete classes which implement interfaces, e.g. instance of ArrayList which implement List or instances of HashMap which implement Map.




Attachment(s):
4069_concrete_class_equals_not_intended.png
4069_instance_variable_of_concrete_class.png
4069_object_equals_null_settings.png
3 comments

Alex wrote:

See attached pictures.

There is an inspection "Object.equals(null)". For some reason it's
flagging several places in my code,even though the parameter to
equals is not null. Is this a new inspection? I don't remember
seeing it before.


A bug, sorry, fixed already.
http://www.jetbrains.net/jira/browse/IDEADEV-3522

Also, some of my classes are getting flagged "Instance variable of
concrete class Foo". I thought this was only flagging instances of
concrete classes which implement interfaces, e.g. instance of
ArrayList which implement List or instances of HashMap which
implement Map.


Nothing has changed in this inspection recently and this inspection also
does not mark any instance variables of classes from libraries. Flagging
of variables declared as ArrayList instead of List is done by the
"Collection declared by class, not interface". You are welcome to
suggest any changes, because I think that currently the "** of concrete
class" inspections are not very useful.

Bas

0

>> You are welcome to suggest any changes, because I think that currently the "** of concrete class" inspections are not very useful.

Ok.. I thought it was a bug. I guess I must have accidentally enabled those, because I hadn't seen them before. I definitely agree those of those concrete inspections are useless, and should be removed. Maybe Dave needed to add some filler to make the world record for most java inspections.

Instance variable of concrete class
Local variable of concrete class
Method parameter of concrete class
Method return of concrete class
Static variable of concrete class

0

> >> You are welcome to suggest any changes, because I
> think that currently the "** of concrete class"
> inspections are not very useful.
>
> I definitely agree those of those
> concrete inspections are useless, and should be
> removed.

Well removal may be too harsh. With a couple of improvements this group of inspections is for example useful for anybody who is producing an api for others. "Method parameter of concrete class" and "Method return of concrete class" warnings on public methods only would then be good I think.

Bas

0

Please sign in to leave a comment.