Inspection Gadgets for IDEA #2008

Hello all,

I have made a build of the excellent Inspection Gadgets plugin for IDEA
#2008. It took some time posting it here because of the 1 million bytes forum attachment limit. Inspection Gadgets is just a bit larger, so please download it here:
http://www.myjavaserver.com/~basleijdekkers/InspectionGadgets.jar


Changes from the official Inspection Gadgets 1.0 by Dave Griffith:

Bug fixes:

  • Several inspections modified to follow changes to the PSI api.

Affected inspections (not entirely complete list):
Assignment to 'null'
Assignment used as condition
Floating point equality comparison
Object comparison using ==, instead of '.equals()'
String comparison using ==, instead of '.equals()'
Subtraction in compareTo()
Overly complex class
Assignment to for-loop parameter
Assignment to method parameter
Chained equality comparisons
Value of ++ or -- used
If statement with negated condition
Overly complex arithmetic expression
Overly complex boolean expression
Assignment to Collection or array field from parameter
String concatenation
Overly complex method
Method with more than three negations
Single character string concatenation
Manual array copy
Multiply or divide by power of two
StringBuffer.toString() in concatenation
String concatenation in loop
Unnecessary 'if' statement
Comparison of short and char values
Object comparison using ==, instead of '.equals()'
String comparison using ==, instead of '.equals()'
Redundant boolean comparison
Pointless arithmetic expression
Assignment replaceable with operator assignment

  • Interfaces are now disregarded in "clone() doesn't call super.clone()"

  • Array initializers are now recognized in "Zero-length array allocation"

  • static final arrays of zero size are disregarded in "Zero-length array allocation"

  • Fix for IndexOutOfBoundsException in "java.lang import"

  • Fix for IndexOutOfBoundsException in "Redundant import"

  • Fix for NullPointerException in "Redundant import"

  • Fixes for "Unused import" marks used imports as unused.

  • Fix for a couple of exceptions in the quick fix for "Unnecessary fully qualified name"

  • Fix for often occurring exceptions when applying a quick fixes in quick succession.

  • Fix for NullPointerException in "Unnecessary 'if' statement"

  • Fix for NullPointerException in "Unnecessary parentheses"

  • "Unnecessary fully qualified name" now disregards fully qualified names with the same short name as a class in the file which contains the reference.

  • Fix for "Unnecessary parentheses" quick fix incorrectly removing parenthesis from new array expression.

  • Fix for NullPointerException in "Unnecessary boxing"


New features:

  • New quick fixes for:

clone() doesn't declare CloneNotSupportedException
java.lang import
Redundant import
Unused import
Abstract method overrides abstract method
Utility class without private constructor
Utility class with public constructor

  • The quick fix of the following inspections rename the method to the proper casing instead of calling the rename refactoring dialog:

'compareto()' instead of 'compareTo()'
'hashcode()' instead of 'hashCode()'
'setup()' instead of 'setUp()'
'teardown()' instead of 'tearDown()'

  • "Unnecessary fully qualified name" now has option to ignore fully qualified names in javadoc comments

  • "Local variable hides member variable" now has option to ignore local variables in static methods.


For everybody who finds this plugin as useful as I do. Thanks for making
it Dave!

Bas

6 comments
Comment actions Permalink

Wow, this totally kicks ass. I didn't realize you had done nearly this much. If you could mail me the sources I will merge them in with my changes. Then I'll get them to JetBrains, as it looks like that's going ahead...

(And by the way, you give way better release notes than I've ever managed to.)

--Dave Griffith

0
Comment actions Permalink

On 21-04-2004 15:43, Dave Griffith wrote:

Wow, this totally kicks ass. I didn't realize you had done nearly
this much. If you could mail me the sources I will merge them in
with my changes. Then I'll get them to JetBrains, as it looks like
that's going ahead...


I have attached all sources to this message, if that's all right.

(And by the way, you give way better release notes than I've ever
managed to.)


Actually next time I'm going to write more incomprehensible release
notes, that way more people will reply with questions and I can get a
feel for the interest people have;-)

Cheers,
Bas




Attachment(s):
inspection_gadget_src.zip
0
Comment actions Permalink

Bas Leijdekkers wrote:

  • "Unnecessary fully qualified name"


Bas or Dave, Can you improve this inspection so that it catches
unnecessary FQN's that are the same as the package to which the Java
file belongs?

Thanks,
Jon

0
Comment actions Permalink


Should be doing that already. I'll look into it.

--Dave Griffith

0
Comment actions Permalink

FYI - I was using the later version of the plugin modified by Bas.

Dave Griffith wrote:

Should be doing that already. I'll look into it.

--Dave Griffith

0
Comment actions Permalink

I could be I did something I shouldn't have done. It won't be until monday until I have time to try and fix the problem.

Bas

0

Please sign in to leave a comment.