Batch Analysis For Potential equals() / hashCode() Incongruencies?

Hi,

Is there a way to get IDEA to analyze an entire project looking for potential problems involving the congruency requirement between equals() and hashCode()?


Thanks.


Randall Schulz

7 comments
Comment actions Permalink

Answering my own question:

The PMD Plug-in can do this and many more batch heuristic analyses on your code.


Randall Schulz

0
Comment actions Permalink

Hello Randall,

Is there a way to get IDEA to analyze an entire project looking for
potential problems involving the congruency requirement between
equals() and hashCode()?


Analyze | Inspect Code... with "equals() and hashCode() not paired" inspection.

--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0
Comment actions Permalink

Haha, the default install of IntelliJ IDEA can do close to all of PMD's and many more batch heuristic analyses on your code.

Bas

0
Comment actions Permalink

It's not nice to laugh at people!

And perusing the help topics did not help me, so perhaps the joke's on you folks!

Anyway, I'm realizing that PMD's diagnostics are weak in some ways. E.g., it warns about excessive parentheses, but when I look at the code, the parens it's complaining about are in string constants! And tests about improper null tests are also clearly being done lexically, not semantically.

So I'm happy to hear that IDEA's more sound understanding of Java code can be used to do what I want. But I do wish it were easier to discover its (IDEA's) capabilities!


Randall Schulz

0
Comment actions Permalink

Sorry Randall, I did not mean to be offensive, but it sounded like you were joking. Also I am not an employee of Jetbrains, although I do development on some of the included plugins.

IntelliJ IDEA's static analysis features are one of its strong points in many peoples opinion. I am not a big user of the help documentation, but it looks like some information about static analysis can be found in the following place of the help tree:
IntelliJ IDEA / Concepts / Code Analysis / Code Inspection

Also if you have any further questions do not hesitate to ask.

Best regards,
Bas

0
Comment actions Permalink

Hi, Bas,

Not to worry. I wasn't offended.

I did have the impression that people who have the gold and blue IJ logo next to their name in forum posts were JetBrains employees.

And, of course, I am aware that the deep semantic knowledge of Java is IDEA's great strength, it's just that clearly my awareness is in fact a bit dim.


RRS

0
Comment actions Permalink

Hi Randall,

Glad to see you were not offended, it is sometimes hard to tell from text only.

I did have the impression that people who have the gold and blue IJ logo next to their name in forum posts were JetBrains employees.


Evidently not in all cases. There are a few external people who have the logo too. I got it when I received developer privileges on the old bug tracker. That way I could mark bug reports for InspectionGadgets and IntentionPowerPak (which I maintain) as fixed and other things.

I guess it is a little confusing, but it makes me feel special;-)

Bas

0

Please sign in to leave a comment.