Free to build

All warnings in the JDK repository resolved

Natali Vlatko
Break prohibition image via Shutterstock

After months of work, a major milestone has been reached for Java’s JDK repository, which now builds warning-free – that’s a whopping several thousand warnings being taken care of.

News has emerged regarding the JDK repository now being free of build warnings for the upcoming JDK 9, as a result of months of work by Oracle engineers led by Joe Darcy. As he so eloquently puts it in his announcement of the milestone: “And then there were none”.

Warnings eliminated

Darcy’s particular project was to repair and review fixes of javac lint warnings in the JDK 9 code base, and once a warning category was cleared, make new instances of that category appear as a fatal build error. With this completed, every warning in the JDK repository has been resolved and -Xlint:all -Werror is now used in the build.

Even though some of the linting warnings that came up previously were harmless, the clearing of this technical debt will now eliminate the possibility of bugs hiding inside the flagged code. With the new instances now listed as a fatal build error, the warning category cannot return to the codebase.

Advice for Java developers has been compiled by Darcy on his Oracle blog, where he shares tips for others looking to tackle the issue of warnings. For his own project, he comments on the how the team went about clearing the debt in the first place:

A warnings cleanup isn’t really done until introducing new instances of the warning cause a build failure; new warnings are too easy to ignore otherwise. Therefore, for JDK 9, the effort was organized around clearing the whole jdk repository of a warning category and then enabling that warning category in the build as opposed to, say, completely clearing a particular package of all warnings and then moving to the next package.

Darcy also explains that the milestone was made possible by a small change in the language (to make efforts tractable), as well as a round of cleanup in the code. For those interested in the changeset, it can be seen here.

Natali Vlatko
An Australian who calls Berlin home, via a two year love affair with Singapore. Natali was an Editorial Assistant for (S&S Media Group).

Inline Feedbacks
View all comments