How to add options to the javac build in the JDK 8 repo?

Joe Darcy joe.darcy at oracle.com
Tue Aug 13 18:09:09 UTC 2013


Hello build gurus,

In in effort to have javac help us maintain good code quality in the jdk 
8 repo, I'd like to turn on selected lint warnings and make them errors. 
In particular, the set of javac options I want to try out is

-Xlint:-unchecked,-deprecation,auxiliaryclass,classfile,divzero,empty,fallthrough,finally,try,varargs 
-Werror

That is, treat as an error any of the auxiliaryclass,classfile, ... lint 
categories. The jdk repo's code should already be clean on these 
categories and I'd like to get it clean on other categories before JDK 8 
ships.

In any case, how does one get these javac options added to the build? 
I've tried

--- a/makefiles/CompileJavaClasses.gmk    Tue Aug 13 10:12:03 2013 -0700
+++ b/makefiles/CompileJavaClasses.gmk    Tue Aug 13 11:07:01 2013 -0700
@@ -291,6 +291,7 @@

  $(eval $(call SetupJavaCompilation,BUILD_JDK,\
                  SETUP:=GENERATE_JDKBYTECODE,\
+ 
FLAGS:=-Xlint:-unchecked,-deprecation,auxiliaryclass,classfile,divzero,empty,fallthrough,finally,try,varargs 
-Werror,\
          SRC:=$(JDK_TOPDIR)/src/share/classes \
               $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/classes \
               $(MACOSX_SRC_DIRS) \

(as well as trying ADD_JAVAC_FLAGS instead of FLAGS), but get an error like

CompileJavaClasses.gmk:292: *** Internal makefile error: Too many 
arguments to SetupJavaCompilation, please update JavaCompilation.gmk.  Stop.

Thanks,

-Joe



More information about the build-dev mailing list