JDK 12 RFR of JDK-8206083: Make tools/javac/api/T6265137.java robust to JDK version changes

joe darcy joe.darcy at oracle.com
Thu Jun 28 23:18:01 UTC 2018


Hello,

Please review the change  below for

     JDK-8206083: Make tools/javac/api/T6265137.java robust to JDK 
version changes
     http://cr.openjdk.java.net/~darcy/8206083.0/

which removes the need to explicitly update this test when the JDK 
version changes, assuming the JDK version corresponds to a valid -target 
value.

Alternatively, the target option to pass could be derived from 
information in javax.lang.model.SourceVersion.

Thanks,

-Joe

--- old/test/langtools/tools/javac/api/T6265137.java 2018-06-28 
16:13:53.531566685 -0700
+++ new/test/langtools/tools/javac/api/T6265137.java    2018-06-28 
16:13:52.683142659 -0700
@@ -52,7 +52,9 @@
              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", "12"), 
null, files).call();
+            javac.getTask(null, fm, dl,
+                          Arrays.asList("-target", 
Integer.toString(Runtime.version().feature())),
+                          null, files).call();
          }
      }
  }



More information about the compiler-dev mailing list