lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shawn Heisey <>
Subject Re: Reducing the number of warnings in the codebase
Date Tue, 18 Mar 2014 12:41:21 GMT
On 3/16/2014 2:48 PM, Uwe Schindler wrote:
> I would prefer: Before we fix warnings by 3rd party tools like Eclipse, we should first
fix only the warnings emitted by Javac. The others are just unimportant to me and I don't
want to fix those which are just wrong for our code style.

Additional followup:

With help from Steve Rowe via IRC, I got -Werror working with the ant
build.  Although some of the warnings I found were straightforward to
eliminate, I quickly got myself into trouble when trying to fix the raw
usage of Map that is all over ValueSource and its descendants.  It seems
that these classes cannot be restricted to specific K or V types, at
least not as they are written now.  Do we just suppress them?  I'd like
to treat it as a bug, but I'm guessing that the vague Map usage was
completely intentional.

On switch case fall-through:  Some of them can be fixed with break
statements, but a number of them are intentional.  Is there a way to get
the compiler to suppress the warning?  I couldn't see one.  Various IDEs
have comment annotations that will cause the warnings to be ignored
within the IDE, but there are no standards.

On the IDE side, specifically for eclipse:

Ignoring 'usage of a raw type' problems removes 3006 warnings -- nearly
half of them.  I think a large percentage of these should be fixed, and
those that truly cannot be changed should be ignored with
SuppressWarnings.  I don't think we should actually disable this
warning, for two reasons:  1) This also appears to be flagged as a
warning by the compiler.  2) Properly using parameters can reveal hidden
problems as errors at compile time.  Long-term, I would actually go
further with this -- use parameters on more of our own classes.

Ignoring 'missing serialVersionUID' removes 198 warnings.  We should do

Checking the 'ignore unavoidable generic type problems' box removes 426
warnings.  What exactly this might mean is not clear to me, but we
should probably do this.

Below are the results of some experimentation with Errors/Warnings in
eclipse.  I didn't try all of the options I found.

Disabling deprecation warning: removes 853 warnings
'Comparing identical values' to error: adds 1 error
'Assignment has no effect' to error: adds 5 errors
'Possible accidental boolean assignment' to error: adds 4 errors
'redundant type arguments' (needs diamond) to error: adds 21 errors
'switch missing default case' to error: adds 267 errors
'switch case fallthrough' to error: adds 79 errors
'incomplete switch cases on enum' to error (but not if default present):
adds 24 errors
'dead code' to error: adds 58 errors


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message