File tree Expand file tree Collapse file tree 5 files changed +22
-9
lines changed Expand file tree Collapse file tree 5 files changed +22
-9
lines changed Original file line number Diff line number Diff line change @@ -92,10 +92,6 @@ REFERENCE_TAGS := $(JAVADOC_TAGS)
9292JAVADOC_DISABLED_DOCLINT_WARNINGS := missing
9393JAVADOC_DISABLED_DOCLINT_PACKAGES := org.w3c.* javax.smartcardio
9494
95- # Allow overriding on the command line
96- # (intentionally sharing name with the javac option)
97- JAVA_WARNINGS_ARE_ERRORS ?= -Werror
98-
9995# The initial set of options for javadoc
10096JAVADOC_OPTIONS := -use -keywords -notimestamp \
10197 -serialwarn -encoding ISO-8859-1 -docencoding UTF-8 -breakiterator \
@@ -322,7 +318,9 @@ define SetupApiDocsGenerationBody
322318 # Ignore the doclint warnings in certain packages
323319 $1_OPTIONS += -Xdoclint/package:$$(call CommaList, $$(addprefix -, \
324320 $$(JAVADOC_DISABLED_DOCLINT_PACKAGES)))
325- $1_OPTIONS += $$(JAVA_WARNINGS_ARE_ERRORS)
321+ ifeq ($$(JAVA_WARNINGS_AS_ERRORS), true)
322+ $1_OPTIONS += -Werror
323+ endif
326324
327325 $1_DOC_TITLE := $$($1_LONG_NAME)<br>Version $$(VERSION_SPECIFICATION) API \
328326 Specification
Original file line number Diff line number Diff line change @@ -261,6 +261,7 @@ JDKOPT_ENABLE_DISABLE_CDS_ARCHIVE_COH
261261JDKOPT_ENABLE_DISABLE_COMPATIBLE_CDS_ALIGNMENT
262262JDKOPT_SETUP_MACOSX_SIGNING
263263JDKOPT_SETUP_SIGNING_HOOK
264+ JDKOPT_SETUP_JAVA_WARNINGS
264265
265266# ###############################################################################
266267#
Original file line number Diff line number Diff line change @@ -988,6 +988,18 @@ AC_DEFUN([JDKOPT_SETUP_SIGNING_HOOK],
988988 AC_SUBST ( SIGNING_HOOK )
989989] )
990990
991+ # ###############################################################################
992+ #
993+ # Setup how javac should handle warnings.
994+ #
995+ AC_DEFUN ( [ JDKOPT_SETUP_JAVA_WARNINGS] ,
996+ [
997+ UTIL_ARG_ENABLE(NAME: java-warnings-as-errors, DEFAULT: true,
998+ RESULT: JAVA_WARNINGS_AS_ERRORS,
999+ DESC: [ consider java warnings to be an error] )
1000+ AC_SUBST ( JAVA_WARNINGS_AS_ERRORS )
1001+ ] )
1002+
9911003# ###############################################################################
9921004#
9931005# fallback linker
Original file line number Diff line number Diff line change @@ -517,6 +517,7 @@ DISABLED_WARNINGS_CXX := @DISABLED_WARNINGS_CXX@
517517
518518# A global flag (true or false) determining if native warnings are considered errors.
519519WARNINGS_AS_ERRORS := @WARNINGS_AS_ERRORS@
520+ JAVA_WARNINGS_AS_ERRORS := @JAVA_WARNINGS_AS_ERRORS@
520521
521522CFLAGS_CCACHE := @CFLAGS_CCACHE@
522523ADLC_LANGSTD_CXXFLAGS := @ADLC_LANGSTD_CXXFLAGS@
Original file line number Diff line number Diff line change @@ -264,15 +264,16 @@ define SetupJavaCompilationBody
264264 $$(error Invalid value for COMPILER in SetupJavaCompilation for $1: '$$($1_COMPILER)')
265265 endif
266266
267- # Allow overriding on the command line
268- JAVA_WARNINGS_ARE_ERRORS ?= -Werror
269-
270267 # Tell javac to do exactly as told and no more
271268 PARANOIA_FLAGS := -implicit:none -Xprefer:source -XDignore.symbol.file=true -encoding ascii
272269
273- $1_FLAGS += -g -Xlint:all $$($1_TARGET_RELEASE) $$(PARANOIA_FLAGS) $$(JAVA_WARNINGS_ARE_ERRORS)
270+ $1_FLAGS += -g -Xlint:all $$($1_TARGET_RELEASE) $$(PARANOIA_FLAGS)
274271 $1_FLAGS += $$($1_JAVAC_FLAGS)
275272
273+ ifeq ($$(JAVA_WARNINGS_AS_ERRORS), true)
274+ $1_FLAGS += -Werror
275+ endif
276+
276277 ifneq ($$($1_DISABLED_WARNINGS), )
277278 $1_FLAGS += -Xlint:$$(call CommaList, $$(addprefix -, $$($1_DISABLED_WARNINGS)))
278279 endif
You can’t perform that action at this time.
0 commit comments