Pieter wrote:I suggest turning on the following:
- Unnecessary cast or instanceof operator: 3x
- Unused or unread private member 7x
- Local variable is never read 8x
- Empty statement 3x
- Local variable declaration hides another field or variable: 3x
(I usually uncheck "include constructor or setter method params", so I can use
this.field = field style assignment in those methods)
- field declaration hides another field or variable 0x
Ok for all. Also add
- Assignment has no effect
- Unqualified access to instance field
This last will result on almost 2.000 hits
, but we should fix someday...
These are all trivial to fix and most of them make the code more readable (except maybe for the Empty statement which is more of a style issue than readability)
Pieter wrote:
If we fix these, there is one killer left:
- access to non-accessible member of an enclosing type: 28x
This one is not trivial to fix, and maybe you don't want it fixed. This warning signals that in an inner class you use a method or field that is normally not accessible. To fix this, the compiler generates an artificial method with the right accessibility (default accessibility I would guess), and generates a method call instead of the direct access.
The "... Increasing its visiblity will improve your performance.. " is really interesting
To me, we turn on all these suggestions, but I would like to do this after the release of RC 4, as making this little fixes will require changes on many files, and I want to prevent bugs of this kind ( *prevent* )
Rafael
[originally posted on jforum.net by Rafael Steil]