From 8e3570cfc22f643d553a9b99c7fabaff0b7c9a79 Mon Sep 17 00:00:00 2001 From: Erik Joelsson Date: Fri, 15 Jun 2018 09:53:28 -0700 Subject: [PATCH] 8204973: Add build support for filtering translations Reviewed-by: ihse, naoto, dfuchs --- make/CompileJavaModules.gmk | 1 + make/ZipSource.gmk | 11 ++ make/autoconf/configure.ac | 1 + make/autoconf/jdk-options.m4 | 24 +++- make/autoconf/spec.gmk.in | 2 + make/common/JavaCompilation.gmk | 14 +++ make/common/MakeBase.gmk | 16 +++ make/common/ZipArchive.gmk | 29 ++++- make/conf/jib-profiles.js | 3 +- make/gensrc/Gensrc-jdk.localedata.gmk | 1 + make/gensrc/GensrcCommonLangtools.gmk | 4 + make/gensrc/GensrcProperties.gmk | 12 +- test/jdk/TEST.ROOT | 3 +- test/jdk/TEST.groups | 6 +- .../releaseFile/CheckSource.java | 0 .../translations/VerifyTranslations.java | 114 ++++++++++++++++++ .../java/util/logging/LocalizedLevelName.java | 26 ++-- test/jtreg-ext/requires/VMProps.java | 17 +++ 18 files changed, 256 insertions(+), 28 deletions(-) rename test/jdk/{sanity => build}/releaseFile/CheckSource.java (100%) create mode 100644 test/jdk/build/translations/VerifyTranslations.java diff --git a/make/CompileJavaModules.gmk b/make/CompileJavaModules.gmk index 058f9a58eb8..15f9eaf439e 100644 --- a/make/CompileJavaModules.gmk +++ b/make/CompileJavaModules.gmk @@ -519,6 +519,7 @@ jdk.localedata_COPY += _dict _th # Exclude BreakIterator classes that are just used in compile process to generate # data files and shouldn't go in the product jdk.localedata_EXCLUDE_FILES += sun/text/resources/ext/BreakIteratorRules_th.java +jdk.localedata_KEEP_ALL_TRANSLATIONS := true ################################################################################ # There is an issue in sjavac that triggers a warning in jdk.jfr that isn't diff --git a/make/ZipSource.gmk b/make/ZipSource.gmk index 9b03ed98cd5..f2aefeb846f 100644 --- a/make/ZipSource.gmk +++ b/make/ZipSource.gmk @@ -68,6 +68,17 @@ TARGETS += $(SRC_ZIP_SRCS) # Only evaluate the creation of src.zip in a sub make call when the symlinked # src directory structure has been generated. ifeq ($(SRC_GENERATED), true) + + # Rewrite the EXCLUDE_TRANSLATIONS locales as exclude patters for java files + TRANSLATIONS_PATTERN := $(addprefix %_, $(addsuffix .java, $(EXCLUDE_TRANSLATIONS))) + + # Add excludes for translations for all modules except jdk.localedata + $(foreach s, $(SRC_ZIP_SRCS), \ + $(if $(filter $(notdir $s), jdk.localedata), , \ + $(eval BUILD_SRC_ZIP_EXCLUDE_PATTERNS_$(dir $s) := $$(TRANSLATIONS_PATTERN)) \ + ) \ + ) + $(eval $(call SetupZipArchive, BUILD_SRC_ZIP, \ SRC := $(dir $(SRC_ZIP_SRCS)), \ INCLUDES := $(SRC_ZIP_INCLUDES), \ diff --git a/make/autoconf/configure.ac b/make/autoconf/configure.ac index 7fa1e99cc3b..9aaab365ec4 100644 --- a/make/autoconf/configure.ac +++ b/make/autoconf/configure.ac @@ -232,6 +232,7 @@ HOTSPOT_SETUP_JVM_FEATURES JDKOPT_DETECT_INTREE_EC JDKOPT_ENABLE_DISABLE_FAILURE_HANDLER JDKOPT_ENABLE_DISABLE_GENERATE_CLASSLIST +JDKOPT_EXCLUDE_TRANSLATIONS ############################################################################### # diff --git a/make/autoconf/jdk-options.m4 b/make/autoconf/jdk-options.m4 index 21d77167dd3..9e13eb73f3c 100644 --- a/make/autoconf/jdk-options.m4 +++ b/make/autoconf/jdk-options.m4 @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -582,3 +582,25 @@ AC_DEFUN_ONCE([JDKOPT_ENABLE_DISABLE_GENERATE_CLASSLIST], AC_SUBST(ENABLE_GENERATE_CLASSLIST) ]) + +################################################################################ +# +# Optionally filter resource translations +# +AC_DEFUN([JDKOPT_EXCLUDE_TRANSLATIONS], +[ + AC_ARG_WITH([exclude-translations], [AS_HELP_STRING([--with-exclude-translations], + [a comma separated list of locales to exclude translations for. Default is + to include all translations present in the source.])]) + + EXCLUDE_TRANSLATIONS="" + AC_MSG_CHECKING([if any translations should be excluded]) + if test "x$with_exclude_translations" != "x"; then + EXCLUDE_TRANSLATIONS="${with_exclude_translations//,/ }" + AC_MSG_RESULT([yes: $EXCLUDE_TRANSLATIONS]) + else + AC_MSG_RESULT([no]) + fi + + AC_SUBST(EXCLUDE_TRANSLATIONS) +]) diff --git a/make/autoconf/spec.gmk.in b/make/autoconf/spec.gmk.in index 8de0abeee81..6894ca7ff41 100644 --- a/make/autoconf/spec.gmk.in +++ b/make/autoconf/spec.gmk.in @@ -303,6 +303,8 @@ BUILD_FAILURE_HANDLER := @BUILD_FAILURE_HANDLER@ ENABLE_GENERATE_CLASSLIST := @ENABLE_GENERATE_CLASSLIST@ +EXCLUDE_TRANSLATIONS := @EXCLUDE_TRANSLATIONS@ + # The boot jdk to use. This is overridden in bootcycle-spec.gmk. Make sure to keep # it in sync. BOOT_JDK:=@BOOT_JDK@ diff --git a/make/common/JavaCompilation.gmk b/make/common/JavaCompilation.gmk index 4fbd0d9241e..a1cdd9264d7 100644 --- a/make/common/JavaCompilation.gmk +++ b/make/common/JavaCompilation.gmk @@ -180,6 +180,7 @@ endef # CREATE_API_DIGEST:=Set to true to use a javac plugin to generate a public API # hash which can be used for down stream dependencies to only rebuild # when the API changes. Implicitly used in sjavac. +# KEEP_ALL_TRANSLATIONS:=Set to true to skip translation filtering SetupJavaCompilation = $(NamedParamsMacroTemplate) define SetupJavaCompilationBody @@ -266,6 +267,11 @@ define SetupJavaCompilationBody $$(eval $1_$$(relative_src) := 1) $$(s)))) endif + # Filter out any excluded translations + ifneq ($$($1_KEEP_ALL_TRANSLATIONS), true) + $1_SRCS := $$(call FilterExcludedTranslations, $$($1_SRCS), .java) + endif + ifeq ($$(strip $$($1_SRCS)), ) ifneq ($$($1_FAIL_NO_SRC), false) $$(error No source files found for $1) @@ -290,6 +296,10 @@ define SetupJavaCompilationBody ifneq (,$$($1_EXCLUDE_PATTERN)) $1_ALL_COPIES := $$(filter-out $$($1_EXCLUDE_PATTERN),$$($1_ALL_COPIES)) endif + # Filter out any excluded translations + ifneq ($$($1_KEEP_ALL_TRANSLATIONS), true) + $1_ALL_COPIES := $$(call FilterExcludedTranslations, $$($1_ALL_COPIES), .properties) + endif ifneq (,$$($1_ALL_COPIES)) # Yep, there are files to be copied! $1_ALL_COPY_TARGETS:= @@ -310,6 +320,10 @@ define SetupJavaCompilationBody ifneq (,$$($1_EXCLUDE_PATTERN)) $1_ALL_CLEANS := $$(filter-out $$($1_EXCLUDE_PATTERN),$$($1_ALL_CLEANS)) endif + # Filter out any excluded translations + ifneq ($$($1_KEEP_ALL_TRANSLATIONS), true) + $1_ALL_CLEANS := $$(call FilterExcludedTranslations, $$($1_ALL_CLEANS), .properties) + endif ifneq (,$$($1_ALL_CLEANS)) # Yep, there are files to be copied and cleaned! $1_ALL_COPY_CLEAN_TARGETS:= diff --git a/make/common/MakeBase.gmk b/make/common/MakeBase.gmk index b3a59e14aa1..d397fe6f9c8 100644 --- a/make/common/MakeBase.gmk +++ b/make/common/MakeBase.gmk @@ -1074,6 +1074,22 @@ ColonList = \ $(subst ::,:,$(subst $(SPACE),:,$(strip $1))) \ ) +################################################################################ +# Given a list of files, filters out locale specific files for translations +# that should be excluded from this build. +# $1 - The list of files to filter +# $2 - The suffix of the files that should be considered (.java or .properties) +FilterExcludedTranslations = \ + $(strip $(if $(EXCLUDE_TRANSLATIONS), \ + $(filter-out \ + $(foreach suffix, $2, \ + $(addprefix %_, $(addsuffix $(suffix), $(EXCLUDE_TRANSLATIONS))) \ + ), \ + $1 \ + ), \ + $1 \ + )) + ################################################################################ # Hook to include the corresponding custom file, if present. diff --git a/make/common/ZipArchive.gmk b/make/common/ZipArchive.gmk index eae37b5ffde..4ced471d9aa 100644 --- a/make/common/ZipArchive.gmk +++ b/make/common/ZipArchive.gmk @@ -42,6 +42,10 @@ endif # INCLUDE_FILES # EXCLUDES # EXCLUDE_FILES +# EXCLUDE_PATTERNS - Patterns with at most one % wildcard matching filenames +# and not directories. +# EXCLUDE_PATTERNS_$dir - Exclude patterns just like above but specific to one +# src dir # SUFFIXES # EXTRA_DEPS # ZIP_OPTIONS extra options to pass to zip @@ -88,11 +92,26 @@ define SetupZipArchiveBody $1_ALL_SRCS := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_ALL_SRCS)) endif ifneq ($$($1_EXCLUDE_FILES),) - # Cannot precompute ZIP_EXCLUDE_FILES as it is dependent on which src root is being - # zipped at the moment. $1_SRC_EXCLUDE_FILES := $$(addprefix %, $$($1_EXCLUDE_FILES)) $$($1_EXCLUDE_FILES) $1_ALL_SRCS := $$(filter-out $$($1_SRC_EXCLUDE_FILES), $$($1_ALL_SRCS)) + $$(foreach s, $$($1_SRC), \ + $$(eval $1_ZIP_EXCLUDES_$$s += \ + $$(addprefix -x$$(SPACE), $$(patsubst $$s/%,%, $$($1_EXCLUDE_FILES))) \ + ) \ + ) endif + ifneq ($$($1_EXCLUDE_PATTERNS), ) + $1_ALL_SRCS := $$(filter-out $$($1_EXCLUDE_PATTERNS), $$($1_ALL_SRCS)) + $1_ZIP_EXCLUDES += $$(addprefix -x$(SPACE), $$(subst %,\*,$$($1_EXCLUDE_PATTERNS))) + endif + # Rewrite src dir specific exclude patterns to zip excludes + $$(foreach s, $$($1_SRC), \ + $$(if $$($1_EXCLUDE_PATTERNS_$$s), \ + $$(eval $1_ZIP_EXCLUDES_$$s += \ + $$(addprefix -x$$(SPACE), $$(subst %,\*,$$($1_EXCLUDE_PATTERNS_$$s))) \ + ) \ + ) \ + ) # Use a slightly shorter name for logging, but with enough path to identify this zip. $1_NAME:=$$(subst $$(OUTPUTDIR)/,,$$($1_ZIP)) @@ -107,9 +126,9 @@ define SetupZipArchiveBody $$($1_ZIP) : $$($1_ALL_SRCS) $$($1_EXTRA_DEPS) $(MKDIR) -p $$(@D) $(ECHO) Updating $$($1_NAME) - $$(foreach i,$$($1_SRC),(cd $$i && $(ZIPEXE) -qru $$($1_ZIP_OPTIONS) $$@ . $$($1_ZIP_INCLUDES) \ - $$($1_ZIP_EXCLUDES) -x \*_the.\* \ - $$(addprefix -x$(SPACE), $$(patsubst $$i/%,%, $$($1_EXCLUDE_FILES))) \ + $$(foreach s,$$($1_SRC),(cd $$s && $(ZIPEXE) -qru $$($1_ZIP_OPTIONS) $$@ . \ + $$($1_ZIP_INCLUDES) $$($1_ZIP_EXCLUDES) -x \*_the.\* \ + $$($1_ZIP_EXCLUDES_$$s) \ || test "$$$$?" = "12" )$$(NEWLINE)) true $(TOUCH) $$@ diff --git a/make/conf/jib-profiles.js b/make/conf/jib-profiles.js index cc48bedb4ce..b858ea992b7 100644 --- a/make/conf/jib-profiles.js +++ b/make/conf/jib-profiles.js @@ -242,7 +242,8 @@ var getJibProfilesCommon = function (input, data) { dependencies: ["boot_jdk", "gnumake", "jtreg", "jib"], default_make_targets: ["product-bundles", "test-bundles"], configure_args: concat(["--enable-jtreg-failure-handler"], - versionArgs(input, common)) + "--with-exclude-translations=de,es,fr,it,ko,pt_BR,sv,ca,tr,cs,sk,ja_JP_A,ja_JP_HA,ja_JP_HI,ja_JP_I", + versionArgs(input, common)) }; // Extra settings for debug profiles common.debug_suffix = "-debug"; diff --git a/make/gensrc/Gensrc-jdk.localedata.gmk b/make/gensrc/Gensrc-jdk.localedata.gmk index 137ce73e0f6..20795487480 100644 --- a/make/gensrc/Gensrc-jdk.localedata.gmk +++ b/make/gensrc/Gensrc-jdk.localedata.gmk @@ -38,6 +38,7 @@ include GensrcProperties.gmk $(eval $(call SetupCompileProperties, COMPILE_PROPERTIES, \ SRC_DIRS := $(TOPDIR)/src/jdk.localedata/share/classes/sun/util/resources, \ CLASS := sun.util.resources.LocaleNamesBundle, \ + KEEP_ALL_TRANSLATIONS := true, \ )) # Skip generating zh_HK from zh_TW for this module. diff --git a/make/gensrc/GensrcCommonLangtools.gmk b/make/gensrc/GensrcCommonLangtools.gmk index 97b5a5dd24f..682808c37ab 100644 --- a/make/gensrc/GensrcCommonLangtools.gmk +++ b/make/gensrc/GensrcCommonLangtools.gmk @@ -66,6 +66,9 @@ define SetupCompileProperties PROPSOURCES := $2 \ $$(shell $(FIND) $(TOPDIR)/src/$(MODULE)/share/classes -name "*.properties") + # Filter out any excluded translations + PROPSOURCES := $$(call FilterExcludedTranslations, $$(PROPSOURCES), .properties) + # Convert .../src//share/classes/com/sun/tools/javac/resources/javac_zh_CN.properties # to .../langtools/gensrc//com/sun/tools/javac/resources/javac_zh_CN.java # Strip away prefix and suffix, leaving for example only: @@ -105,6 +108,7 @@ endef define SetupParseProperties # property files to process PARSEPROPSOURCES := $$(addprefix $(TOPDIR)/src/$(MODULE)/share/classes/, $2) + PARSEPROPSOURCES := $$(call FilterExcludedTranslations, $$(PARSEPROPSOURCES), .properties) PARSEPROPALLDIRS := $$(patsubst $(TOPDIR)/src/$(MODULE)/share/classes/%, \ $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/%, \ diff --git a/make/gensrc/GensrcProperties.gmk b/make/gensrc/GensrcProperties.gmk index b0381e9159c..c8d17a35539 100644 --- a/make/gensrc/GensrcProperties.gmk +++ b/make/gensrc/GensrcProperties.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -59,6 +59,7 @@ endef # EXCLUDE Exclude files matching this pattern. # CLASS The super class for the generated classes. # MODULE_PATH_ROOT Module path root, defaults to $(TOPDIR)/src. +# KEEP_ALL_TRANSLATIONS Set to true to skip filtering of excluded translations. SetupCompileProperties = $(NamedParamsMacroTemplate) define SetupCompilePropertiesBody # Set default value unless overridden @@ -73,10 +74,13 @@ define SetupCompilePropertiesBody $1_SRC_FILES := $$(filter-out $$($1_EXCLUDE), $$($1_SRC_FILES)) endif + # Filter out any excluded translations + ifneq ($$($1_KEEP_ALL_TRANSLATIONS), true) + $1_SRC_FILES := $$(call FilterExcludedTranslations, $$($1_SRC_FILES), .properties) + endif + # Convert .../src//share/classes/com/sun/tools/javac/resources/javac_zh_CN.properties # to .../support/gensrc//com/sun/tools/javac/resources/javac_zh_CN.java - # Strip away prefix and suffix, leaving for example only: - # "/share/classes/com/sun/tools/javac/resources/javac_zh_CN" $1_JAVAS := $$(patsubst $$($1_MODULE_PATH_ROOT)/%, \ $(SUPPORT_OUTPUTDIR)/gensrc/%, \ $$(patsubst %.properties, %.java, \ @@ -99,7 +103,7 @@ define SetupCompilePropertiesBody $1_TARGET := $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the.$1.marker $1_CMDLINE_FILE := $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the.$1.cmdline -# Now setup the rule for the generation of the resource bundles. + # Now setup the rule for the generation of the resource bundles. $$($1_TARGET): $$($1_SRC_FILES) $$($1_JAVAS) $(BUILD_TOOLS_JDK) $(MKDIR) -p $$(@D) $$($1_DIRS) $(ECHO) Compiling $$(words $$($1_SRC_FILES)) properties into resource bundles for $(MODULE) diff --git a/test/jdk/TEST.ROOT b/test/jdk/TEST.ROOT index 78faa90b50e..c9ee93a5452 100644 --- a/test/jdk/TEST.ROOT +++ b/test/jdk/TEST.ROOT @@ -40,7 +40,8 @@ requires.properties= \ vm.gc.Z \ vm.graal.enabled \ vm.cds \ - docker.support + docker.support \ + release.implementor # Minimum jtreg version requiredVersion=4.2 b12 diff --git a/test/jdk/TEST.groups b/test/jdk/TEST.groups index 6e13e2bbd3b..ffa1e660c3b 100644 --- a/test/jdk/TEST.groups +++ b/test/jdk/TEST.groups @@ -39,7 +39,6 @@ tier1_part2 = \ -java/util/Arrays/TimSortStackSize2.java tier1_part3 = \ - :build_sanity \ :jdk_math \ :jdk_svc_sanity \ java/nio/Buffer \ @@ -76,6 +75,7 @@ tier2_part3 = \ :jdk_net tier3 = \ + :build \ :jdk_rmi \ :jdk_beans \ :jdk_imageio \ @@ -88,8 +88,8 @@ tier3 = \ # # Build source checking -build_sanity = \ - sanity/releaseFile +build = \ + build # java.lang package and VM runtime support jdk_lang = \ diff --git a/test/jdk/sanity/releaseFile/CheckSource.java b/test/jdk/build/releaseFile/CheckSource.java similarity index 100% rename from test/jdk/sanity/releaseFile/CheckSource.java rename to test/jdk/build/releaseFile/CheckSource.java diff --git a/test/jdk/build/translations/VerifyTranslations.java b/test/jdk/build/translations/VerifyTranslations.java new file mode 100644 index 00000000000..04f8e9d940c --- /dev/null +++ b/test/jdk/build/translations/VerifyTranslations.java @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.io.BufferedInputStream; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.util.Set; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; + +/** + * @test + * @requires release.implementor == "Oracle Corporation" + * @modules jdk.jlink/jdk.tools.jimage + * @summary Oracle builds of OpenJDK should only contain english, chinese and + * japanese translations + */ +public class VerifyTranslations { + + /** + * The set of translations we want to see in an Oracle built image + */ + private static final Set VALID_TRANSLATION_SUFFIXES = Set.of( + "_en", "_en_US", "_en_US_POSIX", "_ja", "_zh_CN", "_zh_TW", "_zh_HK" + ); + + /** + * This regexp will not match locales with 3 letter lang strings because + * doing so would trigger a ton of false positives all over the source + * tree. This is ok for now but is a potential future flaw in the test. + */ + private static final String BASE_LOCALE_REGEXP + = "(_[a-z]{2}(_[A-Z][a-z]{3})?(_([A-Z]{2})|([0-9]{3}))?(_[a-zA-Z]+)?)"; + + public static void main(String[] args) { + String jdkPath = System.getProperty("test.jdk"); + String modulesFile = jdkPath + "/lib/modules"; + + // Run jimage tool to extract list of all classes and resources in the jdk + StringWriter output = new StringWriter(); + jdk.tools.jimage.Main.run(new String[] { "list", modulesFile }, new PrintWriter(output)); + + Pattern classesLocalePattern = Pattern.compile(BASE_LOCALE_REGEXP + "\\.(class|properties)"); + + boolean failed = false; + String module = ""; + for (String line : output.toString().split("\n")) { + if (line.startsWith("Module: ")) { + module = line.substring(8).trim(); + } + // We do not filter resources in jdk.localedata + if (!module.equals("jdk.localedata")) { + Matcher matcher = classesLocalePattern.matcher(line); + if (matcher.find()) { + if (!VALID_TRANSLATION_SUFFIXES.contains(matcher.group(1))) { + System.out.println("Unsupported translation found in lib/modules: " + + module + "/" + line.trim()); + failed = true; + } + } + } + } + + // Check all files in src.zip + Pattern sourceLocalePattern = Pattern.compile(BASE_LOCALE_REGEXP + "\\.java"); + String srcZip = jdkPath + "/lib/src.zip"; + try (ZipInputStream srcZipInput = new ZipInputStream( + new BufferedInputStream(new FileInputStream(srcZip)))) { + ZipEntry entry; + while ((entry = srcZipInput.getNextEntry()) != null) { + String name = entry.getName(); + if (!name.startsWith("jdk.localedata")) { + Matcher matcher = sourceLocalePattern.matcher(name); + if (matcher.find()) { + if (!VALID_TRANSLATION_SUFFIXES.contains(matcher.group(1))) { + System.out.println("Unsupported translation found in lib/src.zip: " + name); + failed = true; + } + } + } + } + } catch (IOException e) { + throw new RuntimeException(e); + } + + if (failed) { + throw new RuntimeException("lib/modules contains unsupported translations"); + } + } +} diff --git a/test/jdk/java/util/logging/LocalizedLevelName.java b/test/jdk/java/util/logging/LocalizedLevelName.java index 4bb75b6dafd..916de617d01 100644 --- a/test/jdk/java/util/logging/LocalizedLevelName.java +++ b/test/jdk/java/util/logging/LocalizedLevelName.java @@ -34,19 +34,19 @@ import java.util.logging.*; public class LocalizedLevelName { private static Object[] namesMap = { - "SEVERE", Locale.ENGLISH, "Severe", Level.SEVERE, - "WARNING", Locale.FRENCH, "Avertissement", Level.WARNING, - "INFO", Locale.ITALIAN, "Informazioni", Level.INFO, - "SEVERE", Locale.FRENCH, "Grave", Level.SEVERE, - "CONFIG", Locale.GERMAN, "Konfiguration", Level.CONFIG, - "ALL", Locale.ROOT, "All", Level.ALL, - "SEVERE", Locale.ROOT, "Severe", Level.SEVERE, - "WARNING", Locale.ROOT, "Warning", Level.WARNING, - "CONFIG", Locale.ROOT, "Config", Level.CONFIG, - "INFO", Locale.ROOT, "Info", Level.INFO, - "FINE", Locale.ROOT, "Fine", Level.FINE, - "FINER", Locale.ROOT, "Finer", Level.FINER, - "FINEST", Locale.ROOT, "Finest", Level.FINEST + "SEVERE", Locale.ENGLISH, "Severe", Level.SEVERE, + "WARNING", Locale.JAPANESE, "\u8B66\u544A", Level.WARNING, + "INFO", Locale.SIMPLIFIED_CHINESE, "\u4FE1\u606F", Level.INFO, + "SEVERE", Locale.TRADITIONAL_CHINESE, "\u56B4\u91CD", Level.SEVERE, + "CONFIG", Locale.forLanguageTag("zh-HK"), "\u7D44\u614B", Level.CONFIG, + "ALL", Locale.ROOT, "All", Level.ALL, + "SEVERE", Locale.ROOT, "Severe", Level.SEVERE, + "WARNING", Locale.ROOT, "Warning", Level.WARNING, + "CONFIG", Locale.ROOT, "Config", Level.CONFIG, + "INFO", Locale.ROOT, "Info", Level.INFO, + "FINE", Locale.ROOT, "Fine", Level.FINE, + "FINER", Locale.ROOT, "Finer", Level.FINER, + "FINEST", Locale.ROOT, "Finest", Level.FINEST }; public static void main(String args[]) throws Exception { diff --git a/test/jtreg-ext/requires/VMProps.java b/test/jtreg-ext/requires/VMProps.java index 53337110427..b375ff86928 100644 --- a/test/jtreg-ext/requires/VMProps.java +++ b/test/jtreg-ext/requires/VMProps.java @@ -22,7 +22,10 @@ */ package requires; +import java.io.BufferedInputStream; +import java.io.FileInputStream; import java.io.IOException; +import java.io.InputStream; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; @@ -31,6 +34,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Properties; import java.util.concurrent.Callable; import java.util.concurrent.TimeUnit; import java.util.regex.Matcher; @@ -80,6 +84,7 @@ public class VMProps implements Callable> { // vm.graal.enabled is true if Graal is used as JIT map.put("vm.graal.enabled", isGraalEnabled()); map.put("docker.support", dockerSupport()); + map.put("release.implementor", implementor()); vmGC(map); // vm.gc.X = true/false vmOptFinalFlags(map); @@ -396,6 +401,18 @@ public class VMProps implements Callable> { } + private String implementor() { + try (InputStream in = new BufferedInputStream(new FileInputStream( + System.getProperty("java.home") + "/release"))) { + Properties properties = new Properties(); + properties.load(in); + return properties.getProperty("IMPLEMENTOR").replace("\"", ""); + } catch (IOException e) { + e.printStackTrace(); + } + return null; + } + /** * Dumps the map to the file if the file name is given as the property.