Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#1939 closed enhancement (fixed)

Fix javac compiler warnings

Reported by: Nicklas Nordborg Owned by: Nicklas Nordborg
Priority: minor Milestone: BASE 3.6
Component: build Version:
Keywords: Cc:

Description

We are currently compiling all code with -Xlint:unchecked which generate warnings when mixing parameterized types with un-parameterized types. But there are a lot more options to enable for the Xlint parameter. See http://docs.oracle.com/javase/7/docs/technotes/tools/windows/javac.html#nonstandard

Trying with -Xlint:all hits the root with 100+ warnings for almost all compilation steps. It might be worth going through this and see if there is something important.

Change History (10)

comment:1 Changed 6 years ago by Nicklas Nordborg

(In [6869]) References #1939: Fix javac compiler warnings

Remove reference to non-existing (and unused) 'activation.jar' inside MANIFEST.MF.

comment:2 Changed 6 years ago by Nicklas Nordborg

Owner: set to Nicklas Nordborg
Status: newassigned

comment:3 Changed 6 years ago by Nicklas Nordborg

(In [6870]) References #1939: Fix javac compiler warnings

Fixes warnings after setting -Xlint:cast.

comment:4 Changed 6 years ago by Nicklas Nordborg

(In [6872]) References #1939: Fix javac compiler warnings

Fixes warnings after setting -Xlint:overrides.

comment:5 Changed 6 years ago by Nicklas Nordborg

(In [6873]) References #1939: Fix javac compiler warnings

Fixes warnings after setting -Xlint:varargs.

comment:6 Changed 6 years ago by Nicklas Nordborg

[6871] should fix warnings after setting -Xlint:dep-ann. Except for 'rawtypes' none of the other 'Xlint' options generate any warnings. On the other hand the 'rawtypes' option generate lots and lots and lots of warnings.

comment:7 Changed 6 years ago by Nicklas Nordborg

(In [6874]) References #1939: Fix javac compiler warnings

Get rid of generic parameter <D extends BasicData> on BasicItem since it is an internal implementation detail only. As a consequence, all subclasses need to implement the getData() method and cast the result to the proper data-layer subclass. This is more or less the same as was automatically generated by the compiler before (but without the public visibility of it).

This solves a lost of warnings about using unparameterized types when compiling with -Xline:rawtypes.

Note that this change is source-code incompatible with clients that specify a type parameter for BasicItem (eg BasicItem<?>), but the fix is as easy as removing the <?> part.

comment:8 Changed 6 years ago by Nicklas Nordborg

(In [6875]) References #1939: Fix javac compiler warnings

Fixes warnings after setting -Xlint:rawtypes. It should be possible to compile with -Xlint:all without getting any warnings. Some changes may be source-code incompatible, but should hopefully not affect binary compatibility.

comment:9 Changed 6 years ago by Nicklas Nordborg

Resolution: fixed
Status: assignedclosed

comment:10 Changed 6 years ago by Nicklas Nordborg

(In [6913]) References #1939: Fix javac compiler warnings

Remove @SuppressWarnings({"varargs"}) and removed 'varargs' check from -Xlint since this type of warning should already be handled better with the @SafeVarargs annotation. In particular this gets rid of Eclipse complaining about "varargs" not being a valid parameter for @SuppressWarnings.

Note: See TracTickets for help on using tickets.