Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

### Topics

InfoQ Homepage News Java's JDK Repository Now Builds Warning-Free

# Java's JDK Repository Now Builds Warning-Free

OpenJDK, the open-source reference implementation for Java (and basis for Oracle's JDK) has reached a major milestone. The jdk repository, which contains the class libraries, is now free of build warnings for the forthcoming JDK 9. This has been the culmination of many months of effort by Oracle engineers led by Joe Darcy and others, including some community contributions.

Java, like languages such as C, supports a linting mode, where warnings can be generated about bad style and possibly unsafe coding practices. These include cases such as control fallthrough in switch/case statements, and use of Java's raw types. Whilst some of the reports that linting warnings generate are actually benign, it is possible for bugs to be hiding inside the flagged code. Fixing the warnings can expose genuine problems, some of which may be quite subtle.

The approach used is that as each warning subtype is eliminated, the OpenJDK team have made that warning into a fatal error, thereby ensuring that the warning category cannot return to the codebase. As all warning types have now been eliminated the build has enabled the -Xlint:all -Werror switches and all linting warnings are now fatal errors when compiling OpenJDK.

Finally, Darcy has written a blog post containing advice for Java developers who want to use this technique to clear the lint warnings from their own projects.

Style

## Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p