BT

Your opinion matters! Please fill in the InfoQ Readers’ Survey!

Java's JDK Repository Now Builds Warning-Free

| by Ben Evans Follow 35 Followers on Feb 06, 2015. Estimated reading time: 1 minute |

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.

Rate this Article

Adoption Stage
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.

Tell us what you think

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

Email me replies to any of my messages in this thread
Community comments

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

Email me replies to any of my messages in this thread

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

Email me replies to any of my messages in this thread

Discuss
BT