Turning on javac lint warnings when building Java sources in jdk 8 repo

Joe Darcy joe.darcy at oracle.com
Wed Sep 4 18:41:55 PDT 2013


Hi Stuart,

On 9/4/2013 2:09 PM, Stuart Marks wrote:
> Hi Joe,
>
> As you might imagine, I'm all for it. Which specific warnings 
> categories do you envision enabling?

What worked (as of about two weeks ago) was a javac lint setting of

-Xlint:-unchecked,-deprecation,-overrides,auxiliaryclass,classfile,dep-ann,divzero,empty,try,varargs 
-Werror

The corelibs area is clean on a larger set of values than client; for 
example, the core area is clean on "cast" and "static" too.

>
> Some work in the makefiles is probably necessary provide default 
> settings for warnings/errors and to make the settings easily 
> overridable from the command line. The current variable that controls 
> this is DISABLE_WARNINGS (see jdk/makefiles/Setup.gmk) which is 
> probably a misnomer. (But the specifics of makefile changes probably 
> ought to be discussed on build-dev.)

FWIW, the patch I had out for review renamed "DISABLE_WARNINGS" to 
"JAVAC_WARNINGS".

Cheers,

-Joe

>
> s'marks
>
>
> On 9/3/13 6:40 PM, Joe Darcy wrote:
>> Hello,
>>
>> Over the last few months, over on core-libs-dev there have been various
>> clean up efforts concerning the Java code in the JDK 8 "jdk" repo,
>> resolving both javac lint and doclint warnings.
>>
>> With these clean ups in place, I think it is time for selected
>> categories of javac lint warnings to be enabled during the build under
>> -Werror. That is, for lint categories that have been scrubbed, the build
>> should be reconfigured so that reintroducing such a warning is a build
>> error. (Under the old build, different packages could use different
>> javac command line options. With the new build, all the Java code is
>> compiled under the same options so the full build was reduced to the
>> least restrictive javac lint setting.)
>>
>> As additional warning categories are resolved, the set of enabled lint
>> categories could be expanded, potentially including doclint 
>> categories too.
>>
>> Cheers,
>>
>> -Joe
>>
>> [1]
>> http://mail.openjdk.java.net/pipermail/build-dev/2013-August/009806.html



More information about the jdk8-dev mailing list