# HG changeset patch # User prr # Date 1521824575 25200 # Node ID f4188d890101c9c20ed5b24a0d83644db0e52404 # Parent 67b897123581956faaf8b7ec3dfeecbc04f6dfee# Parent 3556298e481d8b7f3b9d9ed679db7515992fcead Merge diff -r 67b897123581 -r f4188d890101 doc/testing.html --- a/doc/testing.html Fri Mar 23 08:49:58 2018 -0700 +++ b/doc/testing.html Fri Mar 23 10:02:55 2018 -0700 @@ -40,7 +40,7 @@ $ make run-test-jdk_lang JTREG="JOBS=8" $ make run-test TEST=jdk_lang $ make run-test-only TEST="gtest:LogTagSet gtest:LogTagSetDescriptions" GTEST="REPEAT=-1" -$ make run-test TEST="hotspot/test:hotspot_gc" JTREG="JOBS=1;TIMEOUT=8;VM_OTIONS=-XshowSettings -Xlog:gc+ref=debug" +$ make run-test TEST="hotspot/test:hotspot_gc" JTREG="JOBS=1;TIMEOUT=8;VM_OPTIONS=-XshowSettings -Xlog:gc+ref=debug" $ make run-test TEST="jtreg:hotspot/test:hotspot_gc hotspot/test/native_sanity/JniVersion.java" $ make exploded-run-test TEST=hotspot_tier1

Configuration

@@ -77,8 +77,8 @@

Test suite control

It is possible to control various aspects of the test suites using make control variables.

These variables use a keyword=value approach to allow multiple values to be set. So, for instance, JTREG="JOBS=1;TIMEOUT=8" will set the JTReg concurrency level to 1 and the timeout factor to 8. This is equivalent to setting JTREG_JOBS=1 JTREG_TIMEOUT=8, but using the keyword format means that the JTREG variable is parsed and verified for correctness, so JTREG="TMIEOUT=8" would give an error, while JTREG_TMIEOUT=8 would just pass unnoticed.

-

To separate multiple keyword=value pairs, use ; (semicolon). Since the shell normally eats ;, the recommended usage is to write the assignment inside qoutes, e.g. JTREG="...;...". This will also make sure spaces are preserved, as in JTREG="VM_OTIONS=-XshowSettings -Xlog:gc+ref=debug".

-

(Other ways are possible, e.g. using backslash: JTREG=JOBS=1\;TIMEOUT=8. Also, as a special technique, the string %20 will be replaced with space for certain options, e.g. JTREG=VM_OTIONS=-XshowSettings%20-Xlog:gc+ref=debug. This can be useful if you have layers of scripts and have trouble getting proper quoting of command line arguments through.)

+

To separate multiple keyword=value pairs, use ; (semicolon). Since the shell normally eats ;, the recommended usage is to write the assignment inside qoutes, e.g. JTREG="...;...". This will also make sure spaces are preserved, as in JTREG="VM_OPTIONS=-XshowSettings -Xlog:gc+ref=debug".

+

(Other ways are possible, e.g. using backslash: JTREG=JOBS=1\;TIMEOUT=8. Also, as a special technique, the string %20 will be replaced with space for certain options, e.g. JTREG=VM_OPTIONS=-XshowSettings%20-Xlog:gc+ref=debug. This can be useful if you have layers of scripts and have trouble getting proper quoting of command line arguments through.)

As far as possible, the names of the keywords have been standardized between test suites.

JTReg keywords

JOBS

diff -r 67b897123581 -r f4188d890101 doc/testing.md --- a/doc/testing.md Fri Mar 23 08:49:58 2018 -0700 +++ b/doc/testing.md Fri Mar 23 10:02:55 2018 -0700 @@ -18,7 +18,7 @@ $ make run-test-jdk_lang JTREG="JOBS=8" $ make run-test TEST=jdk_lang $ make run-test-only TEST="gtest:LogTagSet gtest:LogTagSetDescriptions" GTEST="REPEAT=-1" - $ make run-test TEST="hotspot/test:hotspot_gc" JTREG="JOBS=1;TIMEOUT=8;VM_OTIONS=-XshowSettings -Xlog:gc+ref=debug" + $ make run-test TEST="hotspot/test:hotspot_gc" JTREG="JOBS=1;TIMEOUT=8;VM_OPTIONS=-XshowSettings -Xlog:gc+ref=debug" $ make run-test TEST="jtreg:hotspot/test:hotspot_gc hotspot/test/native_sanity/JniVersion.java" $ make exploded-run-test TEST=hotspot_tier1 @@ -140,11 +140,11 @@ To separate multiple keyword=value pairs, use `;` (semicolon). Since the shell normally eats `;`, the recommended usage is to write the assignment inside qoutes, e.g. `JTREG="...;..."`. This will also make sure spaces are preserved, -as in `JTREG="VM_OTIONS=-XshowSettings -Xlog:gc+ref=debug"`. +as in `JTREG="VM_OPTIONS=-XshowSettings -Xlog:gc+ref=debug"`. (Other ways are possible, e.g. using backslash: `JTREG=JOBS=1\;TIMEOUT=8`. Also, as a special technique, the string `%20` will be replaced with space for -certain options, e.g. `JTREG=VM_OTIONS=-XshowSettings%20-Xlog:gc+ref=debug`. +certain options, e.g. `JTREG=VM_OPTIONS=-XshowSettings%20-Xlog:gc+ref=debug`. This can be useful if you have layers of scripts and have trouble getting proper quoting of command line arguments through.) diff -r 67b897123581 -r f4188d890101 make/scripts/compare.sh --- a/make/scripts/compare.sh Fri Mar 23 08:49:58 2018 -0700 +++ b/make/scripts/compare.sh Fri Mar 23 10:02:55 2018 -0700 @@ -1298,22 +1298,37 @@ # Find the common images to compare, prioritizing later build stages if [ -d "$THIS/install/jdk" ] && [ -d "$OTHER/install/jdk" ]; then THIS_JDK="$THIS/install/jdk" - THIS_JRE="$THIS/install/jre" OTHER_JDK="$OTHER/install/jdk" - OTHER_JRE="$OTHER/install/jre" - echo "Selecting install images for compare" + echo "Selecting install images for JDK compare" + if [ -d "$THIS/install/jre" ] && [ -d "$OTHER/install/jre" ]; then + THIS_JRE="$THIS/install/jre" + OTHER_JRE="$OTHER/install/jre" + echo "Also selecting install images for JRE compare" + else + echo "No install JRE image found" + fi elif [ -d "$THIS/images/jdk" ] && [ -d "$OTHER/deploy/images/jdk" ]; then THIS_JDK="$THIS/images/jdk" - THIS_JRE="$THIS/images/jre" OTHER_JDK="$OTHER/deploy/images/jdk" - OTHER_JRE="$OTHER/deploy/images/jre" - echo "Selecting deploy images for compare" + echo "Selecting deploy images for JDK compare" + if [ -d "$THIS/images/jre" ] && [ -d "$OTHER/deploy/images/jre" ]; then + THIS_JRE="$THIS/images/jre" + OTHER_JRE="$OTHER/deploy/images/jre" + echo "Selecting deploy images for JRE compare" + else + echo "No deploy JRE image found" + fi elif [ -d "$THIS/images/jdk" ] && [ -d "$OTHER/images/jdk" ]; then THIS_JDK="$THIS/images/jdk" - THIS_JRE="$THIS/images/jre" OTHER_JDK="$OTHER/images/jdk" - OTHER_JRE="$OTHER/images/jre" - echo "Selecting jdk images for compare" + echo "Selecting normal images for JDK compare" + if [ -d "$THIS/images/jre" ] && [ -d "$OTHER/images/jre" ]; then + THIS_JRE="$THIS/images/jre" + OTHER_JRE="$OTHER/images/jre" + echo "Selecting normal images for JRE compare" + else + echo "No normal JRE image found" + fi elif [ -d "$(ls -d $THIS/licensee-src/build/*/images/jdk 2> /dev/null)" ] \ && [ -d "$(ls -d $OTHER/licensee-src/build/*/images/jdk 2> /dev/null)" ] then @@ -1406,9 +1421,11 @@ else OTHER_SEC_DIR="$OTHER/tmp" fi - OTHER_SEC_BIN="$OTHER_SEC_DIR/sec-bin.zip" - THIS_SEC_DIR="$THIS/images" - THIS_SEC_BIN="$THIS_SEC_DIR/sec-bin.zip" + if [ -f "$THIS_SEC_DIR/sec-bin.zip" ]; then + OTHER_SEC_BIN="$OTHER_SEC_DIR/sec-bin.zip" + THIS_SEC_DIR="$THIS/images" + THIS_SEC_BIN="$THIS_SEC_DIR/sec-bin.zip" + fi if [ "$OPENJDK_TARGET_OS" = "windows" ]; then if [ "$OPENJDK_TARGET_CPU" = "x86_64" ]; then JGSS_WINDOWS_BIN="jgss-windows-x64-bin.zip" @@ -1437,11 +1454,12 @@ if [ -n "$THIS_JDK" ] && [ -n "$OTHER_JDK" ]; then echo -n "JDK " compare_dirs $THIS_JDK $OTHER_JDK $COMPARE_ROOT/jdk + echo -n "JDK " + compare_files $THIS_JDK $OTHER_JDK $COMPARE_ROOT/jdk + fi + if [ -n "$THIS_JRE" ] && [ -n "$OTHER_JRE" ]; then echo -n "JRE " compare_dirs $THIS_JRE $OTHER_JRE $COMPARE_ROOT/jre - - echo -n "JDK " - compare_files $THIS_JDK $OTHER_JDK $COMPARE_ROOT/jdk echo -n "JRE " compare_files $THIS_JRE $OTHER_JRE $COMPARE_ROOT/jre fi @@ -1480,49 +1498,38 @@ fi fi -if [ "$CMP_PERMS" = "true" ]; then +if [ "$CMP_LIBS" = "true" ]; then if [ -n "$THIS_JDK" ] && [ -n "$OTHER_JDK" ]; then echo -n "JDK " - compare_permissions $THIS_JDK $OTHER_JDK $COMPARE_ROOT/jdk - echo -n "JRE " - compare_permissions $THIS_JRE $OTHER_JRE $COMPARE_ROOT/jre + compare_all_libs $THIS_JDK $OTHER_JDK $COMPARE_ROOT/jdk fi if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then - compare_permissions $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir + compare_all_libs $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir fi if [ -n "$THIS_DEPLOY_APPLET_PLUGIN_DIR" ] && [ -n "$OTHER_DEPLOY_APPLET_PLUGIN_DIR" ]; then echo -n "JavaAppletPlugin " - compare_permissions $THIS_DEPLOY_APPLET_PLUGIN_DIR $OTHER_DEPLOY_APPLET_PLUGIN_DIR $COMPARE_ROOT/plugin + compare_all_libs $THIS_DEPLOY_APPLET_PLUGIN_DIR $OTHER_DEPLOY_APPLET_PLUGIN_DIR $COMPARE_ROOT/plugin fi if [ -n "$THIS_SPARKLE_DIR" ] && [ -n "$OTHER_SPARKLE_DIR" ]; then echo -n "Sparkle.framework " - compare_permissions $THIS_SPARKLE_DIR $OTHER_SPARKLE_DIR $COMPARE_ROOT/sparkle + compare_all_libs $THIS_SPARKLE_DIR $OTHER_SPARKLE_DIR $COMPARE_ROOT/sparkle fi fi -if [ "$CMP_TYPES" = "true" ]; then +if [ "$CMP_EXECS" = "true" ]; then if [ -n "$THIS_JDK" ] && [ -n "$OTHER_JDK" ]; then - echo -n "JDK " - compare_file_types $THIS_JDK $OTHER_JDK $COMPARE_ROOT/jdk - echo -n "JRE " - compare_file_types $THIS_JRE $OTHER_JRE $COMPARE_ROOT/jre - fi - if [ -n "$THIS_JDK_BUNDLE" ] && [ -n "$OTHER_JDK_BUNDLE" ]; then - echo -n "JDK Bundle " - compare_file_types $THIS_JDK_BUNDLE $OTHER_JDK_BUNDLE $COMPARE_ROOT/jdk-bundle - echo -n "JRE Bundle " - compare_file_types $THIS_JRE_BUNDLE $OTHER_JRE_BUNDLE $COMPARE_ROOT/jre-bundle + compare_all_execs $THIS_JDK $OTHER_JDK $COMPARE_ROOT/jdk fi if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then - compare_file_types $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir + compare_all_execs $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir fi if [ -n "$THIS_DEPLOY_APPLET_PLUGIN_DIR" ] && [ -n "$OTHER_DEPLOY_APPLET_PLUGIN_DIR" ]; then echo -n "JavaAppletPlugin " - compare_file_types $THIS_DEPLOY_APPLET_PLUGIN_DIR $OTHER_DEPLOY_APPLET_PLUGIN_DIR $COMPARE_ROOT/plugin + compare_all_execs $THIS_DEPLOY_APPLET_PLUGIN_DIR $OTHER_DEPLOY_APPLET_PLUGIN_DIR $COMPARE_ROOT/plugin fi if [ -n "$THIS_SPARKLE_DIR" ] && [ -n "$OTHER_SPARKLE_DIR" ]; then echo -n "Sparkle.framework " - compare_file_types $THIS_SPARKLE_DIR $OTHER_SPARKLE_DIR $COMPARE_ROOT/sparkle + compare_all_execs $THIS_SPARKLE_DIR $OTHER_SPARKLE_DIR $COMPARE_ROOT/sparkle fi fi @@ -1530,6 +1537,8 @@ if [ -n "$THIS_JDK" ] && [ -n "$OTHER_JDK" ]; then echo -n "JDK " compare_general_files $THIS_JDK $OTHER_JDK $COMPARE_ROOT/jdk + fi + if [ -n "$THIS_JRE" ] && [ -n "$OTHER_JRE" ]; then echo -n "JRE " compare_general_files $THIS_JRE $OTHER_JRE $COMPARE_ROOT/jre fi @@ -1601,46 +1610,53 @@ fi fi -if [ "$CMP_LIBS" = "true" ]; then +if [ "$CMP_PERMS" = "true" ]; then if [ -n "$THIS_JDK" ] && [ -n "$OTHER_JDK" ]; then echo -n "JDK " - compare_all_libs $THIS_JDK $OTHER_JDK $COMPARE_ROOT/jdk - if [ "$OPENJDK_TARGET_OS" = "macosx" ]; then - echo -n "JRE " - compare_all_libs $THIS_JRE $OTHER_JRE $COMPARE_ROOT/jre - fi + compare_permissions $THIS_JDK $OTHER_JDK $COMPARE_ROOT/jdk + fi + if [ -n "$THIS_JRE" ] && [ -n "$OTHER_JRE" ]; then + echo -n "JRE " + compare_permissions $THIS_JRE $OTHER_JRE $COMPARE_ROOT/jre fi if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then - compare_all_libs $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir + compare_permissions $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir fi if [ -n "$THIS_DEPLOY_APPLET_PLUGIN_DIR" ] && [ -n "$OTHER_DEPLOY_APPLET_PLUGIN_DIR" ]; then echo -n "JavaAppletPlugin " - compare_all_libs $THIS_DEPLOY_APPLET_PLUGIN_DIR $OTHER_DEPLOY_APPLET_PLUGIN_DIR $COMPARE_ROOT/plugin + compare_permissions $THIS_DEPLOY_APPLET_PLUGIN_DIR $OTHER_DEPLOY_APPLET_PLUGIN_DIR $COMPARE_ROOT/plugin fi if [ -n "$THIS_SPARKLE_DIR" ] && [ -n "$OTHER_SPARKLE_DIR" ]; then echo -n "Sparkle.framework " - compare_all_libs $THIS_SPARKLE_DIR $OTHER_SPARKLE_DIR $COMPARE_ROOT/sparkle + compare_permissions $THIS_SPARKLE_DIR $OTHER_SPARKLE_DIR $COMPARE_ROOT/sparkle fi fi -if [ "$CMP_EXECS" = "true" ]; then +if [ "$CMP_TYPES" = "true" ]; then if [ -n "$THIS_JDK" ] && [ -n "$OTHER_JDK" ]; then - compare_all_execs $THIS_JDK $OTHER_JDK $COMPARE_ROOT/jdk - if [ "$OPENJDK_TARGET_OS" = "macosx" ]; then - echo -n "JRE " - compare_all_execs $THIS_JRE $OTHER_JRE $COMPARE_ROOT/jre - fi + echo -n "JDK " + compare_file_types $THIS_JDK $OTHER_JDK $COMPARE_ROOT/jdk + fi + if [ -n "$THIS_JRE" ] && [ -n "$OTHER_JRE" ]; then + echo -n "JRE " + compare_file_types $THIS_JRE $OTHER_JRE $COMPARE_ROOT/jre + fi + if [ -n "$THIS_JDK_BUNDLE" ] && [ -n "$OTHER_JDK_BUNDLE" ]; then + echo -n "JDK Bundle " + compare_file_types $THIS_JDK_BUNDLE $OTHER_JDK_BUNDLE $COMPARE_ROOT/jdk-bundle + echo -n "JRE Bundle " + compare_file_types $THIS_JRE_BUNDLE $OTHER_JRE_BUNDLE $COMPARE_ROOT/jre-bundle fi if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then - compare_all_execs $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir + compare_file_types $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir fi if [ -n "$THIS_DEPLOY_APPLET_PLUGIN_DIR" ] && [ -n "$OTHER_DEPLOY_APPLET_PLUGIN_DIR" ]; then echo -n "JavaAppletPlugin " - compare_all_execs $THIS_DEPLOY_APPLET_PLUGIN_DIR $OTHER_DEPLOY_APPLET_PLUGIN_DIR $COMPARE_ROOT/plugin + compare_file_types $THIS_DEPLOY_APPLET_PLUGIN_DIR $OTHER_DEPLOY_APPLET_PLUGIN_DIR $COMPARE_ROOT/plugin fi if [ -n "$THIS_SPARKLE_DIR" ] && [ -n "$OTHER_SPARKLE_DIR" ]; then echo -n "Sparkle.framework " - compare_all_execs $THIS_SPARKLE_DIR $OTHER_SPARKLE_DIR $COMPARE_ROOT/sparkle + compare_file_types $THIS_SPARKLE_DIR $OTHER_SPARKLE_DIR $COMPARE_ROOT/sparkle fi fi diff -r 67b897123581 -r f4188d890101 make/scripts/compare_exceptions.sh.incl --- a/make/scripts/compare_exceptions.sh.incl Fri Mar 23 08:49:58 2018 -0700 +++ b/make/scripts/compare_exceptions.sh.incl Fri Mar 23 10:02:55 2018 -0700 @@ -339,7 +339,7 @@ DIS_DIFF_FILTER="$SED \ -e 's/^[0-9a-f]\{16\}/:/' \ - -e 's/^ *[0-9a-f]\{3,8\}:/ :/' \ + -e 's/^ *[0-9a-f]\{3,12\}:/ :/' \ -e 's/: [0-9a-f][0-9a-f]\( [0-9a-f][0-9a-f]\)\{2,10\}/: /' \ -e 's/\$[a-zA-Z0-9_\$]\{15\}\././' \ -e 's/, [0-9a-fx\-]\{1,8\}/, /g' \ diff -r 67b897123581 -r f4188d890101 src/java.base/share/native/libjava/System.c --- a/src/java.base/share/native/libjava/System.c Fri Mar 23 08:49:58 2018 -0700 +++ b/src/java.base/share/native/libjava/System.c Fri Mar 23 10:02:55 2018 -0700 @@ -244,21 +244,8 @@ PUTPROP(props, "line.separator", sprops->line_separator); /* - * user.language - * user.script, user.country, user.variant (if user's environment specifies them) - * file.encoding + * file encoding for stdout and stderr */ - PUTPROP(props, "user.language", sprops->language); - if (sprops->script) { - PUTPROP(props, "user.script", sprops->script); - } - if (sprops->country) { - PUTPROP(props, "user.country", sprops->country); - } - if (sprops->variant) { - PUTPROP(props, "user.variant", sprops->variant); - } - PUTPROP(props, "file.encoding", sprops->encoding); if (sprops->sun_stdout_encoding != NULL) { PUTPROP(props, "sun.stdout.encoding", sprops->sun_stdout_encoding); } @@ -314,7 +301,7 @@ #endif /* !!! DO NOT call PUTPROP_ForPlatformNString before this line !!! - * !!! I18n properties have not been set up yet !!! + * !!! The platform native encoding for strings has not been set up yet !!! */ InitializeEncoding(env, sprops->sun_jnu_encoding); @@ -379,17 +366,6 @@ PUTPROP(props, "sun.desktop", sprops->desktop); } - /* - * unset "user.language", "user.script", "user.country", and "user.variant" - * in order to tell whether the command line option "-DXXXX=YYYY" is - * specified or not. They will be reset in fillI18nProps() below. - */ - REMOVEPROP(props, "user.language"); - REMOVEPROP(props, "user.script"); - REMOVEPROP(props, "user.country"); - REMOVEPROP(props, "user.variant"); - REMOVEPROP(props, "file.encoding"); - ret = JVM_InitProperties(env, props); /* reconstruct i18n related properties */ diff -r 67b897123581 -r f4188d890101 src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java Fri Mar 23 08:49:58 2018 -0700 +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java Fri Mar 23 10:02:55 2018 -0700 @@ -828,7 +828,7 @@ return buf.toList(); } - boolean checkDenotable(Type t) { + public boolean checkDenotable(Type t) { return denotableChecker.visit(t, null); } // where diff -r 67b897123581 -r f4188d890101 src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java Fri Mar 23 08:49:58 2018 -0700 +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java Fri Mar 23 10:02:55 2018 -0700 @@ -43,6 +43,7 @@ import com.sun.tools.javac.code.Symbol.*; import com.sun.tools.javac.code.Type.*; import com.sun.tools.javac.code.Types.UniqueType; +import com.sun.tools.javac.comp.Check; import com.sun.tools.javac.file.PathFileObject; import com.sun.tools.javac.jvm.Pool.DynamicMethod; import com.sun.tools.javac.jvm.Pool.Method; @@ -101,6 +102,8 @@ /** Type utilities. */ private Types types; + private Check check; + /** * If true, class files will be written in module-specific subdirectories * of the CLASS_OUTPUT location. @@ -178,6 +181,7 @@ target = Target.instance(context); source = Source.instance(context); types = Types.instance(context); + check = Check.instance(context); fileManager = context.get(JavaFileManager.class); signatureGen = new CWSignatureGenerator(types); @@ -1294,10 +1298,10 @@ //where private boolean needsLocalVariableTypeEntry(Type t) { //a local variable needs a type-entry if its type T is generic - //(i.e. |T| != T) and if it's not an intersection type (not supported - //in signature attribute grammar) - return (!types.isSameType(t, types.erasure(t)) && - !t.isCompound()); + //(i.e. |T| != T) and if it's not an non-denotable type (non-denotable + // types are not supported in signature attribute grammar!) + return !types.isSameType(t, types.erasure(t)) && + check.checkDenotable(t); } void writeStackMap(Code code) { diff -r 67b897123581 -r f4188d890101 test/jdk/java/util/Locale/LocaleCmdOverrides.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/java/util/Locale/LocaleCmdOverrides.java Fri Mar 23 10:02:55 2018 -0700 @@ -0,0 +1,152 @@ +/* + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.lang.management.ManagementFactory; +import java.lang.management.RuntimeMXBean; +import java.util.List; + +/* + * @test + * @modules java.management + * @summary verify that overriddes on the command line affect *.display and *.format properties + * @run main/othervm + * LocaleCmdOverrides + * @run main/othervm -Duser.language=XX + * -Duser.country=X1 + * -Duser.script=X2 + * -Duser.variant=X3 + * LocaleCmdOverrides + * @run main/othervm -Duser.language=XX -Duser.language.display=YY + * -Duser.country=X1 -Duser.country.display=Y1 + * -Duser.script=X2 -Duser.script.display=Y2 + * -Duser.variant=X3 -Duser.variant.display=Y3 + * LocaleCmdOverrides + * @run main/othervm -Duser.language=XX -Duser.language.display=YY -Duser.language.format=ZZ + * -Duser.country=X1 -Duser.country.display=Y1 -Duser.country.format=Z1 + * -Duser.script=X2 -Duser.script.display=Y2 -Duser.script.format=Z2 + * -Duser.variant=X3 -Duser.variant.display=Y3 -Duser.variant.format=Z3 + * LocaleCmdOverrides + * @run main/othervm -Duser.language=XX -Duser.language.format=ZZ + * -Duser.country=X1 -Duser.country.format=Z1 + * -Duser.script=X2 -Duser.script.format=Z2 + * -Duser.variant=X3 -Duser.variant.format=Z3 + * LocaleCmdOverrides + * @run main/othervm -Duser.language=XX -Duser.language.display=XX + * -Duser.country=X1 -Duser.country.display=X1 + * -Duser.script=X2 -Duser.script.display=X2 + * -Duser.variant=X3 -Duser.variant.display=X3 + * LocaleCmdOverrides + * @run main/othervm -Duser.language=XX -Duser.language.display=XX -Duser.language.format=XX + * -Duser.country=X1 -Duser.country.display=X1 -Duser.country.format=X1 + * -Duser.script=X2 -Duser.script.display=X2 -Duser.script.format=X2 + * -Duser.variant=X3 -Duser.variant.display=X3 -Duser.variant.format=X3 + * LocaleCmdOverrides + * @run main/othervm -Duser.language=XX -Duser.language.format=X1 + * -Duser.country.format=X1 + * -Duser.script.format=X2 + * -Duser.variant.format=X3 + * LocaleCmdOverrides + */ +public class LocaleCmdOverrides { + + // Language, country, script, variant + + public static void main(String[] args) { + Map props = commandLineDefines(); + System.out.printf("props: %s%n", props); + test("user.language", props); + test("user.country", props); + test("user.script", props); + test("user.variant", props); + } + + /* + * Check each of the properties for a given basename. + */ + static void test(String baseName, Map args) { + validateArg(baseName,"", args); + validateArg(baseName,".display", args); + validateArg(baseName,".format", args); + } + + // If an argument is -D defined, the corresponding property must be equal + static void validateArg(String name, String ext, Map args) { + String extName = name.concat(ext); + String arg = args.get(extName); + String prop = System.getProperty(extName); + if (arg == null && prop == null) { + System.out.printf("No values for %s%n", extName); + } else { + System.out.printf("validateArg %s: arg: %s, prop: %s%n", extName, arg, prop); + } + + if (arg != null) { + if (!Objects.equals(arg, prop)) { + throw new RuntimeException(extName + ": -D value should match property: " + + arg + " != " + prop); + } + } else if (prop != null) { + // no command line arg for extName and some value for prop + // Check that if a property is not overridden then it is not equal to the base + if (ext != null && !ext.isEmpty()) { + String value = System.getProperty(name); + if (Objects.equals(value, prop)) { + throw new RuntimeException(extName + " property should not be equals to " + + name + " property: " + prop); + } + } + } + } + + /** + * Extract the -D arguments from the command line and return a map of key, value. + * @return a map of key, values defined by -D on the command line. + */ + static HashMap commandLineDefines() { + HashMap props = new HashMap<>(); + RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean(); + List args = runtime.getInputArguments(); + System.out.printf("args: %s%n", args); + for (String arg : args) { + if (arg.startsWith("-Duser.")) { + String[] kv = arg.substring(2).split("="); + switch (kv.length) { + case 1: + props.put(kv[0], ""); + break; + case 2: + props.put(kv[0], kv[1]); + break; + default: + throw new IllegalArgumentException("Illegal property syntax: " + arg); + } + } + } + return props; + } +} diff -r 67b897123581 -r f4188d890101 test/langtools/tools/javac/T8199910.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/langtools/tools/javac/T8199910.java Fri Mar 23 10:02:55 2018 -0700 @@ -0,0 +1,43 @@ +/* + * 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. + */ + +/* + * @test + * @bug 8199910 + * @summary Compile variables of intersection type inferred by `var` with -g option + * @compile -g T8199910.java + */ +import java.util.List; + +class T8199910 { + T first(T... ts) { + return ts[0]; + } + + void m() { + var list1 = List.of("", 1); + var list2 = List.of(1, 2.0); + var a = first("", 1); + var b = first(1, 2.0); + } +} diff -r 67b897123581 -r f4188d890101 test/langtools/tools/javac/lvti/harness/LocalVariableInferenceTester.java --- a/test/langtools/tools/javac/lvti/harness/LocalVariableInferenceTester.java Fri Mar 23 08:49:58 2018 -0700 +++ b/test/langtools/tools/javac/lvti/harness/LocalVariableInferenceTester.java Fri Mar 23 10:02:55 2018 -0700 @@ -80,12 +80,16 @@ void compileAndCheck(JavaFileObject input) throws IOException { JavaCompiler c = ToolProvider.getSystemJavaCompiler(); - JavacTask task = (JavacTask) c.getTask(null, fm, null, null, null, Arrays.asList(input)); + JavacTask task = (JavacTask) c.getTask(null, fm, null, Arrays.asList("-g"), null, Arrays.asList(input)); JavacTrees trees = JavacTrees.instance(task); Types types = Types.instance(((JavacTaskImpl)task).getContext()); Iterable roots = task.parse(); - task.analyze(); //force attribution Log log = Log.instance(((JavacTaskImpl)task).getContext()); + //force code generation (to shake out non-denotable issues) + boolean hasClasses = task.generate().iterator().hasNext(); + if (!hasClasses) { + throw new AssertionError("Errors occurred during compilation!"); + } errors += log.nerrors; new LocalVarTypeChecker(trees, types).scan(roots, null); System.err.println("Checks executed: " + checks);