Merge
authorprr
Tue, 19 Dec 2017 13:02:39 -0800
changeset 48350 59adf939036a
parent 48349 3d4e8f5a2a69 (current diff)
parent 48343 d4329843abf4 (diff)
child 48351 80176afc8667
Merge
--- a/make/common/SetupJavaCompilers.gmk	Tue Dec 19 11:37:00 2017 -0800
+++ b/make/common/SetupJavaCompilers.gmk	Tue Dec 19 13:02:39 2017 -0800
@@ -69,7 +69,7 @@
 $(eval $(call SetupJavaCompiler,GENERATE_JDKBYTECODE, \
     JVM := $(JAVA_JAVAC), \
     JAVAC := $(NEW_JAVAC), \
-    FLAGS := -source 10 -target 10 --doclint-format html5 \
+    FLAGS := -source 11 -target 11 --doclint-format html5 \
         -encoding ascii -XDignore.symbol.file=true $(JAVAC_WARNINGS), \
     SERVER_DIR := $(SJAVAC_SERVER_DIR), \
     SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
@@ -79,7 +79,7 @@
 $(eval $(call SetupJavaCompiler,GENERATE_JDKBYTECODE_NOWARNINGS, \
     JVM := $(JAVA_JAVAC), \
     JAVAC := $(NEW_JAVAC), \
-    FLAGS := -source 10 -target 10 \
+    FLAGS := -source 11 -target 11 \
         -encoding ascii -XDignore.symbol.file=true $(DISABLE_WARNINGS), \
     SERVER_DIR := $(SJAVAC_SERVER_DIR), \
     SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
--- a/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java	Tue Dec 19 11:37:00 2017 -0800
+++ b/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java	Tue Dec 19 13:02:39 2017 -0800
@@ -57,6 +57,7 @@
      * 1.8: lambda expressions and default methods
      *   9: modules, small cleanups to 1.7 and 1.8 changes
      *  10: local-variable type inference (var)
+     *  11: to be determined changes
      */
 
     /**
@@ -162,7 +163,15 @@
      *
      * @since 10
      */
-     RELEASE_10;
+     RELEASE_10,
+
+    /**
+     * The version recognized by the Java Platform, Standard Edition
+     * 11.
+     *
+     * @since 11
+     */
+     RELEASE_11;
 
     // Note that when adding constants for newer releases, the
     // behavior of latest() and latestSupported() must be updated too.
@@ -173,7 +182,7 @@
      * @return the latest source version that can be modeled
      */
     public static SourceVersion latest() {
-        return RELEASE_10;
+        return RELEASE_11;
     }
 
     private static final SourceVersion latestSupported = getLatestSupported();
@@ -183,6 +192,8 @@
             String specVersion = System.getProperty("java.specification.version");
 
             switch (specVersion) {
+                case "11":
+                    return RELEASE_11;
                 case "10":
                     return RELEASE_10;
                 case "9":
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java	Tue Dec 19 11:37:00 2017 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java	Tue Dec 19 13:02:39 2017 -0800
@@ -78,8 +78,11 @@
     /** 1.9 modularity. */
     JDK9("9"),
 
-    /** 1.10 covers the to be determined language features that will be added in JDK 10. */
-    JDK10("10");
+    /** 1.10 local-variable type inference (var). */
+    JDK10("10"),
+
+    /** 1.11 covers the to be determined language features that will be added in JDK 11. */
+    JDK11("11");
 
     private static final Context.Key<Source> sourceKey = new Context.Key<>();
 
@@ -108,6 +111,7 @@
         tab.put("1.8", JDK8); // Make 8 an alias for 1.8
         tab.put("1.9", JDK9); // Make 9 an alias for 1.9
         tab.put("1.10", JDK10); // Make 10 an alias for 1.10
+        // Decline to make 1.11 an alias for 11.
     }
 
     private Source(String name) {
@@ -125,6 +129,7 @@
     }
 
     public Target requiredTarget() {
+        if (this.compareTo(JDK11) >= 0) return Target.JDK1_11;
         if (this.compareTo(JDK10) >= 0) return Target.JDK1_10;
         if (this.compareTo(JDK9) >= 0) return Target.JDK1_9;
         if (this.compareTo(JDK8) >= 0) return Target.JDK1_8;
@@ -247,6 +252,8 @@
             return RELEASE_9;
         case JDK10:
             return RELEASE_10;
+        case JDK11:
+            return RELEASE_11;
         default:
             return null;
         }
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Profile.java	Tue Dec 19 11:37:00 2017 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Profile.java	Tue Dec 19 13:02:39 2017 -0800
@@ -40,9 +40,9 @@
  *  deletion without notice.</b>
  */
 public enum Profile {
-    COMPACT1("compact1", 1, Target.JDK1_8, Target.JDK1_9, Target.JDK1_10),
-    COMPACT2("compact2", 2, Target.JDK1_8, Target.JDK1_9, Target.JDK1_10),
-    COMPACT3("compact3", 3, Target.JDK1_8, Target.JDK1_9, Target.JDK1_10),
+    COMPACT1("compact1", 1, Target.JDK1_8, Target.JDK1_9, Target.JDK1_10, Target.JDK1_11),
+    COMPACT2("compact2", 2, Target.JDK1_8, Target.JDK1_9, Target.JDK1_10, Target.JDK1_11),
+    COMPACT3("compact3", 3, Target.JDK1_8, Target.JDK1_9, Target.JDK1_10, Target.JDK1_11),
 
     DEFAULT {
         @Override
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Target.java	Tue Dec 19 11:37:00 2017 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Target.java	Tue Dec 19 13:02:39 2017 -0800
@@ -64,7 +64,10 @@
     JDK1_9("1.9", 53, 0),
 
     /** JDK 10. */
-    JDK1_10("1.10", 54, 0);
+    JDK1_10("1.10", 54, 0),
+
+    /** JDK 11. */
+    JDK1_11("11", 54, 0); // Initially an alias for JDK_10
 
     private static final Context.Key<Target> targetKey = new Context.Key<>();
 
@@ -95,6 +98,7 @@
         tab.put("8", JDK1_8);
         tab.put("9", JDK1_9);
         tab.put("10", JDK1_10);
+        tab.put("11", JDK1_11);
     }
 
     public final String name;
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/PrintingProcessor.java	Tue Dec 19 11:37:00 2017 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/PrintingProcessor.java	Tue Dec 19 13:02:39 2017 -0800
@@ -55,7 +55,7 @@
  * deletion without notice.</b>
  */
 @SupportedAnnotationTypes("*")
-@SupportedSourceVersion(SourceVersion.RELEASE_10)
+@SupportedSourceVersion(SourceVersion.RELEASE_11)
 public class PrintingProcessor extends AbstractProcessor {
     PrintWriter writer;
 
--- a/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/LoadProc.java	Tue Dec 19 11:37:00 2017 -0800
+++ b/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/LoadProc.java	Tue Dec 19 13:02:39 2017 -0800
@@ -50,7 +50,7 @@
 
 import javax.tools.Diagnostic;
 
-import static javax.lang.model.SourceVersion.RELEASE_10;
+import static javax.lang.model.SourceVersion.RELEASE_11;
 
 /**
  * Annotation processor for the Deprecation Scanner tool.
@@ -58,7 +58,7 @@
  *
  */
 @SupportedAnnotationTypes("java.lang.Deprecated")
-@SupportedSourceVersion(RELEASE_10)
+@SupportedSourceVersion(RELEASE_11)
 public class LoadProc extends AbstractProcessor {
     Elements elements;
     Messager messager;
--- a/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/Main.java	Tue Dec 19 11:37:00 2017 -0800
+++ b/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/Main.java	Tue Dec 19 13:02:39 2017 -0800
@@ -106,7 +106,7 @@
     // Keep these updated manually until there's a compiler API
     // that allows querying of supported releases.
     final Set<String> releasesWithoutForRemoval = Set.of("6", "7", "8");
-    final Set<String> releasesWithForRemoval = Set.of("9", "10");
+    final Set<String> releasesWithForRemoval = Set.of("9", "10", "11");
 
     final Set<String> validReleases;
     {
@@ -358,14 +358,15 @@
      * Process classes from a particular JDK release, using only information
      * in this JDK.
      *
-     * @param release "6", "7", "8", "9", or "10"
+     * @param release "6", "7", "8", "9", "10", or "11"
      * @param classes collection of classes to process, may be empty
      * @return success value
      */
     boolean processRelease(String release, Collection<String> classes) throws IOException {
         options.addAll(List.of("--release", release));
 
-        if (release.equals("9") || release.equals("10")) {
+        if (release.equals("9") || release.equals("10") ||
+            release.equals("11")) {
             List<String> rootMods = List.of("java.se", "java.se.ee");
             TraverseProc proc = new TraverseProc(rootMods);
             JavaCompiler.CompilationTask task =
@@ -481,7 +482,7 @@
         String dir = null;
         String jar = null;
         String jdkHome = null;
-        String release = "10";
+        String release = "11";
         List<String> loadClasses = new ArrayList<>();
         String csvFile = null;
 
--- a/test/langtools/ProblemList.txt	Tue Dec 19 11:37:00 2017 -0800
+++ b/test/langtools/ProblemList.txt	Tue Dec 19 13:02:39 2017 -0800
@@ -54,6 +54,7 @@
 tools/javac/annotations/typeAnnotations/referenceinfos/NestedTypes.java         8057687    generic-all    emit correct byte code an attributes for type annotations
 tools/javac/warnings/suppress/TypeAnnotations.java                              8057683    generic-all    improve ordering of errors with type annotations
 tools/javac/modules/SourceInSymlinkTest.java                                    8180263    windows-all    fails when run on a subst drive
+tools/javac/options/release/ReleaseOptionUnsupported.java                       8193784    generic-all    temporary until support for --release 11 is worked out
 
 ###########################################################################
 #
@@ -76,3 +77,5 @@
 ###########################################################################
 #
 # jdeps 
+
+tools/jdeprscan/tests/jdk/jdeprscan/TestNotFound.java       8193784    generic-all        temporary until support for --release 11 is worked out
--- a/test/langtools/tools/javac/api/T6265137.java	Tue Dec 19 11:37:00 2017 -0800
+++ b/test/langtools/tools/javac/api/T6265137.java	Tue Dec 19 13:02:39 2017 -0800
@@ -52,7 +52,7 @@
             String srcdir = System.getProperty("test.src");
             Iterable<? extends JavaFileObject> files =
                 fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(srcdir, "T6265137a.java")));
-            javac.getTask(null, fm, dl, Arrays.asList("-target","10"), null, files).call();
+            javac.getTask(null, fm, dl, Arrays.asList("-target","11"), null, files).call();
         }
     }
 }
--- a/test/langtools/tools/javac/api/T6395981.java	Tue Dec 19 11:37:00 2017 -0800
+++ b/test/langtools/tools/javac/api/T6395981.java	Tue Dec 19 13:02:39 2017 -0800
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug     6395981 6458819 7025784 8028543 8028544
+ * @bug     6395981 6458819 7025784 8028543 8028544 8193291
  * @summary JavaCompilerTool and Tool must specify version of JLS and JVMS
  * @author  Peter von der Ah\u00e9
  * @modules java.compiler
@@ -31,7 +31,7 @@
  * @run main/fail T6395981
  * @run main/fail T6395981 RELEASE_3 RELEASE_5 RELEASE_6
  * @run main/fail T6395981 RELEASE_0 RELEASE_1 RELEASE_2 RELEASE_3 RELEASE_4 RELEASE_5 RELEASE_6
- * @run main T6395981 RELEASE_3 RELEASE_4 RELEASE_5 RELEASE_6 RELEASE_7 RELEASE_8 RELEASE_9 RELEASE_10
+ * @run main T6395981 RELEASE_3 RELEASE_4 RELEASE_5 RELEASE_6 RELEASE_7 RELEASE_8 RELEASE_9 RELEASE_10 RELEASE_11
  */
 
 import java.util.EnumSet;
--- a/test/langtools/tools/javac/lib/JavacTestingAbstractProcessor.java	Tue Dec 19 11:37:00 2017 -0800
+++ b/test/langtools/tools/javac/lib/JavacTestingAbstractProcessor.java	Tue Dec 19 13:02:39 2017 -0800
@@ -110,7 +110,7 @@
      * corresponding platform visitor type.
      */
 
-    @SupportedSourceVersion(RELEASE_10)
+    @SupportedSourceVersion(RELEASE_11)
     public static abstract class AbstractAnnotationValueVisitor<R, P> extends AbstractAnnotationValueVisitor9<R, P> {
 
         /**
@@ -121,7 +121,7 @@
         }
     }
 
-    @SupportedSourceVersion(RELEASE_10)
+    @SupportedSourceVersion(RELEASE_11)
     public static abstract class AbstractElementVisitor<R, P> extends AbstractElementVisitor9<R, P> {
         /**
          * Constructor for concrete subclasses to call.
@@ -131,7 +131,7 @@
         }
     }
 
-    @SupportedSourceVersion(RELEASE_10)
+    @SupportedSourceVersion(RELEASE_11)
     public static abstract class AbstractTypeVisitor<R, P> extends AbstractTypeVisitor9<R, P> {
         /**
          * Constructor for concrete subclasses to call.
@@ -141,7 +141,7 @@
         }
     }
 
-    @SupportedSourceVersion(RELEASE_10)
+    @SupportedSourceVersion(RELEASE_11)
     public static class ElementKindVisitor<R, P> extends ElementKindVisitor9<R, P> {
         /**
          * Constructor for concrete subclasses; uses {@code null} for the
@@ -162,7 +162,7 @@
         }
     }
 
-    @SupportedSourceVersion(RELEASE_10)
+    @SupportedSourceVersion(RELEASE_11)
     public static class ElementScanner<R, P> extends ElementScanner9<R, P> {
         /**
          * Constructor for concrete subclasses; uses {@code null} for the
@@ -181,7 +181,7 @@
         }
     }
 
-    @SupportedSourceVersion(RELEASE_10)
+    @SupportedSourceVersion(RELEASE_11)
     public static class SimpleAnnotationValueVisitor<R, P> extends SimpleAnnotationValueVisitor9<R, P> {
         /**
          * Constructor for concrete subclasses; uses {@code null} for the
@@ -202,7 +202,7 @@
         }
     }
 
-    @SupportedSourceVersion(RELEASE_10)
+    @SupportedSourceVersion(RELEASE_11)
     public static class SimpleElementVisitor<R, P> extends SimpleElementVisitor9<R, P> {
         /**
          * Constructor for concrete subclasses; uses {@code null} for the
@@ -223,7 +223,7 @@
         }
     }
 
-    @SupportedSourceVersion(RELEASE_10)
+    @SupportedSourceVersion(RELEASE_11)
     public static class SimpleTypeVisitor<R, P> extends SimpleTypeVisitor9<R, P> {
         /**
          * Constructor for concrete subclasses; uses {@code null} for the
@@ -244,7 +244,7 @@
         }
     }
 
-    @SupportedSourceVersion(RELEASE_10)
+    @SupportedSourceVersion(RELEASE_11)
     public static class TypeKindVisitor<R, P> extends TypeKindVisitor9<R, P> {
         /**
          * Constructor for concrete subclasses to call; uses {@code null}
--- a/test/langtools/tools/javac/processing/model/TestSourceVersion.java	Tue Dec 19 11:37:00 2017 -0800
+++ b/test/langtools/tools/javac/processing/model/TestSourceVersion.java	Tue Dec 19 13:02:39 2017 -0800
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 7025809 8028543 6415644 8028544 8029942
+ * @bug 7025809 8028543 6415644 8028544 8029942 8193291
  * @summary Test latest, latestSupported, underscore as keyword, etc.
  * @author  Joseph D. Darcy
  * @modules java.compiler
@@ -45,7 +45,7 @@
     }
 
     private static void testLatestSupported() {
-        if (SourceVersion.latest() != RELEASE_10 ||
+        if (SourceVersion.latest() != RELEASE_11 ||
             SourceVersion.latestSupported() != RELEASE_10)
             throw new RuntimeException("Unexpected release value(s) found:\n" +
                                        "latest:\t" + SourceVersion.latest() + "\n" +
--- a/test/langtools/tools/javac/profiles/ProfileOptionTest.java	Tue Dec 19 11:37:00 2017 -0800
+++ b/test/langtools/tools/javac/profiles/ProfileOptionTest.java	Tue Dec 19 13:02:39 2017 -0800
@@ -149,6 +149,7 @@
                         break;
                     case JDK1_9:
                     case JDK1_10:
+                    case JDK1_11:
                         if (p == Profile.DEFAULT)
                             break;
                         if (ise == null)
--- a/test/langtools/tools/javac/versions/Versions.java	Tue Dec 19 11:37:00 2017 -0800
+++ b/test/langtools/tools/javac/versions/Versions.java	Tue Dec 19 13:02:39 2017 -0800
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 4981566 5028634 5094412 6304984 7025786 7025789 8001112 8028545 8000961 8030610 8028546 8188870
+ * @bug 4981566 5028634 5094412 6304984 7025786 7025789 8001112 8028545 8000961 8030610 8028546 8188870 8173382
  * @summary Check interpretation of -target and -source options
  * @modules java.compiler
  *          jdk.compiler
@@ -70,22 +70,24 @@
         check("54.0", "-source 1.8");
         check("54.0", "-source 1.9");
         check("54.0", "-source 1.10");
+        check("54.0", "-source 11");
 
-        check_source_target("50.0", "6", "6");
-        check_source_target("51.0", "6", "7");
-        check_source_target("51.0", "7", "7");
-        check_source_target("52.0", "6", "8");
-        check_source_target("52.0", "7", "8");
-        check_source_target("52.0", "8", "8");
-        check_source_target("53.0", "6", "9");
-        check_source_target("53.0", "7", "9");
-        check_source_target("53.0", "8", "9");
-        check_source_target("53.0", "9", "9");
-        check_source_target("54.0", "6", "10");
-        check_source_target("54.0", "7", "10");
-        check_source_target("54.0", "8", "10");
-        check_source_target("54.0", "9", "10");
-        check_source_target("54.0", "10", "10");
+        check_source_target(true, "50.0", "6", "6");
+        check_source_target(true, "51.0", "6", "7");
+        check_source_target(true, "51.0", "7", "7");
+        check_source_target(true, "52.0", "6", "8");
+        check_source_target(true, "52.0", "7", "8");
+        check_source_target(true, "52.0", "8", "8");
+        check_source_target(true, "53.0", "6", "9");
+        check_source_target(true, "53.0", "7", "9");
+        check_source_target(true, "53.0", "8", "9");
+        check_source_target(true, "53.0", "9", "9");
+        check_source_target(true, "54.0", "6", "10");
+        check_source_target(true, "54.0", "7", "10");
+        check_source_target(true, "54.0", "8", "10");
+        check_source_target(true, "54.0", "9", "10");
+        check_source_target(true, "54.0", "10", "10");
+        check_source_target(false, "54.0", "11", "11");
 
         checksrc16("-source 1.6");
         checksrc16("-source 6");
@@ -108,8 +110,9 @@
         checksrc110("-source 10");
         checksrc110("-source 1.10", "-target 1.10");
         checksrc110("-source 10", "-target 10");
-        checksrc110("-target 1.10");
-        checksrc110("-target 10");
+        checksrc111("-source 11");
+        checksrc111("-source 11", "-target 11");
+        checksrc111("-target 11");
 
         fail("-source 7", "-target 1.6", "Base.java");
         fail("-source 8", "-target 1.6", "Base.java");
@@ -118,6 +121,8 @@
         fail("-source 9", "-target 1.8", "Base.java");
         fail("-source 10", "-target 1.7", "Base.java");
         fail("-source 10", "-target 1.8", "Base.java");
+        fail("-source 11", "-target 1.9", "Base.java");
+        fail("-source 11", "-target 1.10", "Base.java");
 
         fail("-source 1.5", "-target 1.5", "Base.java");
         fail("-source 1.4", "-target 1.4", "Base.java");
@@ -139,20 +144,24 @@
         System.out.printf("\n", fname);
     }
 
-    protected void check_source_target(String... args) {
+    protected void check_source_target(boolean dotOne, String... args) {
         printargs("check_source_target", args);
-        check_target(args[0], args[1], args[2]);
-        check_target(args[0], "1." + args[1], args[2]);
+        check_target(dotOne, args[0], args[1], args[2]);
+        if (dotOne) {
+            check_target(dotOne, args[0], "1." + args[1], args[2]);
+        }
     }
 
-    protected void check_target(String... args) {
+    protected void check_target(boolean dotOne, String... args) {
         check(args[0], "-source " + args[1], "-target " + args[2]);
-        check(args[0], "-source " + args[1], "-target 1." + args[2]);
+        if (dotOne) {
+            check(args[0], "-source " + args[1], "-target 1." + args[2]);
+        }
     }
 
     protected void check(String major, String... args) {
         printargs("check", args);
-        List<String> jcargs = new ArrayList<String>();
+        List<String> jcargs = new ArrayList<>();
         jcargs.add("-Xlint:-options");
 
         // add in args conforming to List requrements of JavaCompiler
@@ -207,6 +216,8 @@
         pass(newargs);
         newargs[asize] = "New18.java";
         pass(newargs);
+        newargs[asize] = "New110.java";
+        fail(newargs);
     }
 
     protected void checksrc19(String... args) {
@@ -216,7 +227,20 @@
 
     protected void checksrc110(String... args) {
         printargs("checksrc110", args);
-        checksrc19(args);
+        int asize = args.length;
+        String[] newargs = new String[asize+1];
+        System.arraycopy(args, 0, newargs,0 , asize);
+        newargs[asize] = "New17.java";
+        pass(newargs);
+        newargs[asize] = "New18.java";
+        pass(newargs);
+        newargs[asize] = "New110.java";
+        pass(newargs);
+    }
+
+    protected void checksrc111(String... args) {
+        printargs("checksrc111", args);
+        checksrc110(args);
     }
 
     protected void pass(String... args) {
@@ -347,6 +371,17 @@
             "} \n"
         );
 
+        /*
+         * Create a file with a new feature in 1.10, not in 1.9 : var
+         */
+        writeSourceFile("New110.java",
+            "public class New110 { \n" +
+            "    void m() { \n" +
+            "    var tmp = new Thread(() -> { }); \n" +
+            "    } \n" +
+            "} \n"
+        );
+
     }
 
     protected boolean checkClassFileVersion