Skip to content

Commit 7aeaa3c

Browse files
committed
8187520: Add --disable-java-warnings-as-errors configure option
Reviewed-by: shade, erikj
1 parent cd9fa3f commit 7aeaa3c

File tree

5 files changed

+22
-9
lines changed

5 files changed

+22
-9
lines changed

make/Docs.gmk

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,6 @@ REFERENCE_TAGS := $(JAVADOC_TAGS)
9292
JAVADOC_DISABLED_DOCLINT_WARNINGS := missing
9393
JAVADOC_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
10096
JAVADOC_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

make/autoconf/configure.ac

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ JDKOPT_ENABLE_DISABLE_CDS_ARCHIVE_COH
261261
JDKOPT_ENABLE_DISABLE_COMPATIBLE_CDS_ALIGNMENT
262262
JDKOPT_SETUP_MACOSX_SIGNING
263263
JDKOPT_SETUP_SIGNING_HOOK
264+
JDKOPT_SETUP_JAVA_WARNINGS
264265

265266
################################################################################
266267
#

make/autoconf/jdk-options.m4

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff 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

make/autoconf/spec.gmk.template

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff 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.
519519
WARNINGS_AS_ERRORS := @WARNINGS_AS_ERRORS@
520+
JAVA_WARNINGS_AS_ERRORS := @JAVA_WARNINGS_AS_ERRORS@
520521

521522
CFLAGS_CCACHE := @CFLAGS_CCACHE@
522523
ADLC_LANGSTD_CXXFLAGS := @ADLC_LANGSTD_CXXFLAGS@

make/common/JavaCompilation.gmk

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)