On May 19, 2011, at 11:32 AM, Alan Bateman wrote: > David Holmes wrote: >> : >> >>> In contrast, there are basically two Java compilers in general use (javac >>> and ecj) >>> and one is part of OpenJDK. Yet, the Java code does not have -Werror >>> enabled by default and there >>> are a mass of warnings there as a result. >> >> I don't understand the point you are making here. Does javac even have a >> -Werror? The bulk of javac warnings stem from legacy code being compiled >> under newer compilers with new language features - the resulting code is not >> erroneous hence only a warning is issued. >> >> I think comparing C/C++ compiler warnings with javac compiler warnings is >> like comparing apples and elephants. > Yes, javac has -Werror and the build has JAVAC_WARNINGS_FATAL to turn it on. > I just checked my recent build of the jdk7/jdk7 forest and javac emits a > total of 9 warnings (7 are unsafe usages of varargs methods and the other two > are unreachable catch clauses). That isn't a lot but javac doesn't have many > warnings enabled by default. A nice project for someone would be to change > the build to -Werror by default and gradually crank up the warnings listed by > -Xlint.
I noticed that some parts of the jdk build do use 'javac -Werror', where it was cleaned up they would turn on this flag. But yes, a great project would be to see if we could get to 'javac -Xlint:all -Werror' someday. We really should... in fact it should be a requirement moving forward that all java code be warning free, and stay that way. Not sure about the hotspot java code. -kto > > -Alan. > >