8165109: langtools/test switches to use new CLI options
authormchung
Tue, 30 Aug 2016 20:49:41 -0700
changeset 40763 209113892b0d
parent 40762 f8883aa0053c
child 40764 29ded021f809
8165109: langtools/test switches to use new CLI options Reviewed-by: jjg, amlu
langtools/test/jdk/javadoc/tool/ReleaseOption.java
langtools/test/tools/javac/T8139474/DashRelease7DashVerboseTest.java
langtools/test/tools/javac/diags/examples/ProcessorPathNoProcessorModulePath/ProcessorPathNoProcessorModulePath.java
langtools/test/tools/javac/file/MultiReleaseJar/MultiReleaseJarAwareSJFM.java
langtools/test/tools/javac/file/MultiReleaseJar/MultiReleaseJarTest.java
langtools/test/tools/javac/modules/AnachronisticModuleInfo/AnachronisticModuleInfoTest.java
langtools/test/tools/javac/modules/UpgradeModulePathTest.java
langtools/test/tools/javac/options/release/ReleaseOption.java
langtools/test/tools/javac/options/release/ReleaseOptionClashes.java
langtools/test/tools/javac/options/release/ReleaseOptionThroughAPI.java
langtools/test/tools/javac/platform/PlatformProviderTest.java
langtools/test/tools/javac/sym/ElementStructureTest.java
langtools/test/tools/javac/synthesize/Main.java
langtools/test/tools/javadoc/ReleaseOption.java
langtools/test/tools/lib/toolbox/ModuleBuilder.java
--- a/langtools/test/jdk/javadoc/tool/ReleaseOption.java	Tue Aug 30 17:47:46 2016 -0700
+++ b/langtools/test/jdk/javadoc/tool/ReleaseOption.java	Tue Aug 30 20:49:41 2016 -0700
@@ -33,7 +33,7 @@
 /**
  * @test
  * @bug 8086737
- * @summary Test -release option in javadoc
+ * @summary Test --release option in javadoc
  * @run main ReleaseOption
  * @modules jdk.javadoc/jdk.javadoc.internal.tool
  */
@@ -43,10 +43,10 @@
     }
 
     void run() {
-        doRunTest(0, out -> out.contains("compiler.err.doesnt.exist: java.util.stream"), "-release", "7");
-        doRunTest(0, out -> !out.contains("compiler.err.doesnt.exist: java.util.stream"), "-release", "8");
-        doRunTest(1, out -> true, "-release", "7", "-source", "7");
-        doRunTest(1, out -> true, "-release", "7", "-bootclasspath", "any");
+        doRunTest(0, out -> out.contains("compiler.err.doesnt.exist: java.util.stream"), "--release", "7");
+        doRunTest(0, out -> !out.contains("compiler.err.doesnt.exist: java.util.stream"), "--release", "8");
+        doRunTest(1, out -> true, "--release", "7", "-source", "7");
+        doRunTest(1, out -> true, "--release", "7", "-bootclasspath", "any");
     }
 
     void doRunTest(int expectedResult, Predicate<String> validate, String... args) {
--- a/langtools/test/tools/javac/T8139474/DashRelease7DashVerboseTest.java	Tue Aug 30 17:47:46 2016 -0700
+++ b/langtools/test/tools/javac/T8139474/DashRelease7DashVerboseTest.java	Tue Aug 30 20:49:41 2016 -0700
@@ -24,8 +24,8 @@
 /*
  * @test
  * bug 8139474
- * @summary -release 7 -verbose causes Javac exception
- * @compile -release 7 -verbose DashRelease7DashVerboseTest.java
+ * @summary --release 7 -verbose causes Javac exception
+ * @compile --release 7 -verbose DashRelease7DashVerboseTest.java
 */
 
 public class DashRelease7DashVerboseTest {}
--- a/langtools/test/tools/javac/diags/examples/ProcessorPathNoProcessorModulePath/ProcessorPathNoProcessorModulePath.java	Tue Aug 30 17:47:46 2016 -0700
+++ b/langtools/test/tools/javac/diags/examples/ProcessorPathNoProcessorModulePath/ProcessorPathNoProcessorModulePath.java	Tue Aug 30 20:49:41 2016 -0700
@@ -22,6 +22,6 @@
  */
 
 // key: compiler.err.processorpath.no.processormodulepath
-// options: -processormodulepath mods -processorpath mods
+// options: --processor-module-path mods -processorpath mods
 
 class ProcessorPathNoProcessorModulePath {}
--- a/langtools/test/tools/javac/file/MultiReleaseJar/MultiReleaseJarAwareSJFM.java	Tue Aug 30 17:47:46 2016 -0700
+++ b/langtools/test/tools/javac/file/MultiReleaseJar/MultiReleaseJarAwareSJFM.java	Tue Aug 30 20:49:41 2016 -0700
@@ -174,7 +174,7 @@
         jfm.setLocation(jloc, List.of(new File("multi-release.jar")));
 
         if (version.length() > 0) {
-            jfm.handleOption("-multi-release", List.of(version).iterator());
+            jfm.handleOption("--multi-release", List.of(version).iterator());
         }
 
         CustomClassLoader cldr = new CustomClassLoader(jfm);
--- a/langtools/test/tools/javac/file/MultiReleaseJar/MultiReleaseJarTest.java	Tue Aug 30 17:47:46 2016 -0700
+++ b/langtools/test/tools/javac/file/MultiReleaseJar/MultiReleaseJarTest.java	Tue Aug 30 20:49:41 2016 -0700
@@ -135,12 +135,12 @@
     }
 
     @Test(dataProvider="modes")
-    // javac -d classes -release 8 -cp multi-release.jar Main.java -> succeeds
+    // javac -d classes --release 8 -cp multi-release.jar Main.java -> succeeds
     public void main1Release8(Task.Mode mode) throws Exception {
         tb.writeFile("Main.java", main1);
         Task.Result result = new JavacTask(tb, mode)
                 .outdir("classes")
-                .options("-release", "8")
+                .options("--release", "8")
                 .classpath("multi-release.jar")
                 .files("Main.java")
                 .run();
@@ -149,12 +149,12 @@
     }
 
     @Test(dataProvider="modes")
-    // javac -d classes -release 9 -cp multi-release.jar Main.java -> fails
+    // javac -d classes --release 9 -cp multi-release.jar Main.java -> fails
     public void main1Release9(Task.Mode mode) throws Exception {
         tb.writeFile("Main.java", main1);
         Task.Result result = new JavacTask(tb, mode)
                 .outdir("classes")
-                .options("-release", "9")
+                .options("--release", "9")
                 .classpath("multi-release.jar")
                 .files("Main.java")
                 .run(Task.Expect.FAIL, 1);
@@ -177,12 +177,12 @@
     }
 
     @Test(dataProvider="modes")
-    // javac -d classes -release 8 -cp multi-release.jar Main.java -> fails
+    // javac -d classes --release 8 -cp multi-release.jar Main.java -> fails
     public void main2Release8(Task.Mode mode) throws Exception {
         tb.writeFile("Main.java", main2);
         Task.Result result = new JavacTask(tb, mode)
                 .outdir("classes")
-                .options("-release", "8")
+                .options("--release", "8")
                 .classpath("multi-release.jar")
                 .files("Main.java")
                 .run(Task.Expect.FAIL, 1);
@@ -191,12 +191,12 @@
     }
 
     @Test(dataProvider="modes")
-    // javac -d classes -release 9 -cp multi-release.jar Main.java -> succeeds
+    // javac -d classes --release 9 -cp multi-release.jar Main.java -> succeeds
     public void main2Release9(Task.Mode mode) throws Exception {
         tb.writeFile("Main.java", main2);
         Task.Result result = new JavacTask(tb, mode)
                 .outdir("classes")
-                .options("-release", "9")
+                .options("--release", "9")
                 .classpath("multi-release.jar")
                 .files("Main.java")
                 .run();
--- a/langtools/test/tools/javac/modules/AnachronisticModuleInfo/AnachronisticModuleInfoTest.java	Tue Aug 30 17:47:46 2016 -0700
+++ b/langtools/test/tools/javac/modules/AnachronisticModuleInfo/AnachronisticModuleInfoTest.java	Tue Aug 30 20:49:41 2016 -0700
@@ -78,7 +78,7 @@
 
         String log = new JavacTask(tb, Task.Mode.CMDLINE)
                 .options("-XDrawDiagnostics",
-                        "-upgrademodulepath", modulePath)
+                        "--upgrade-module-path", modulePath)
                 .files(findJavaFiles(src))
                 .run(Task.Expect.FAIL)
                 .writeAll()
--- a/langtools/test/tools/javac/modules/UpgradeModulePathTest.java	Tue Aug 30 17:47:46 2016 -0700
+++ b/langtools/test/tools/javac/modules/UpgradeModulePathTest.java	Tue Aug 30 20:49:41 2016 -0700
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @summary tests for -upgrademodulepath
+ * @summary tests for --upgrade-module-path
  * @library /tools/lib
  * @modules
  *      jdk.compiler/com.sun.tools.javac.api
--- a/langtools/test/tools/javac/options/release/ReleaseOption.java	Tue Aug 30 17:47:46 2016 -0700
+++ b/langtools/test/tools/javac/options/release/ReleaseOption.java	Tue Aug 30 20:49:41 2016 -0700
@@ -1,9 +1,9 @@
 /**
  * @test /nodynamiccopyright/
  * @bug 8072480
- * @summary Verify that javac rejects Java 8 program with -release 7
+ * @summary Verify that javac rejects Java 8 program with --release 7
  * @compile ReleaseOption.java
- * @compile/fail/ref=ReleaseOption-release7.out -XDrawDiagnostics -release 7 ReleaseOption.java
+ * @compile/fail/ref=ReleaseOption-release7.out -XDrawDiagnostics --release 7 ReleaseOption.java
  */
 
 interface ReleaseOption extends java.util.stream.Stream {
--- a/langtools/test/tools/javac/options/release/ReleaseOptionClashes.java	Tue Aug 30 17:47:46 2016 -0700
+++ b/langtools/test/tools/javac/options/release/ReleaseOptionClashes.java	Tue Aug 30 20:49:41 2016 -0700
@@ -24,7 +24,7 @@
 /**
  * @test
  * @bug 8072480
- * @summary Verify option clash between -release and -source is reported correctly.
+ * @summary Verify option clash between --release and -source is reported correctly.
  * @modules jdk.compiler/com.sun.tools.javac.util
  */
 
@@ -62,7 +62,7 @@
         useRawMessages.setBoolean(null, true);
         ByteArrayOutputStream out = new ByteArrayOutputStream();
         List<String> options = new ArrayList<>();
-        options.addAll(Arrays.asList("-release", "7"));
+        options.addAll(Arrays.asList("--release", "7"));
         options.addAll(Arrays.asList(args));
         options.add(System.getProperty("test.src") + File.separator + "ReleaseOptionClashes.java");
         compiler.run(null, null, out, options.toArray(new String[0]));
--- a/langtools/test/tools/javac/options/release/ReleaseOptionThroughAPI.java	Tue Aug 30 17:47:46 2016 -0700
+++ b/langtools/test/tools/javac/options/release/ReleaseOptionThroughAPI.java	Tue Aug 30 20:49:41 2016 -0700
@@ -24,7 +24,7 @@
 /**
  * @test
  * @bug 8072480
- * @summary Verify that javac can handle -release when invoked using the Compiler API
+ * @summary Verify that javac can handle --release when invoked using the Compiler API
  */
 
 import java.io.IOException;
@@ -50,7 +50,7 @@
              PrintWriter outWriter = new PrintWriter(out)) {
             Iterable<? extends JavaFileObject> input =
                     fm.getJavaFileObjects(System.getProperty("test.src") + "/ReleaseOption.java");
-            List<String> options = Arrays.asList("-release", "7", "-XDrawDiagnostics");
+            List<String> options = Arrays.asList("--release", "7", "-XDrawDiagnostics");
 
             compiler.getTask(outWriter, fm, null, options, null, input).call();
             String expected =
--- a/langtools/test/tools/javac/platform/PlatformProviderTest.java	Tue Aug 30 17:47:46 2016 -0700
+++ b/langtools/test/tools/javac/platform/PlatformProviderTest.java	Tue Aug 30 20:49:41 2016 -0700
@@ -101,7 +101,7 @@
                            "-J--add-exports=jdk.compiler/com.sun.tools.javac.platform=ALL-UNNAMED",
                            "-J--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
                            "-XDrawDiagnostics",
-                           "-release",
+                           "--release",
                            platformSpec,
                            System.getProperty("test.src") + "/PlatformProviderTestSource.java")
                   .run();
@@ -135,7 +135,7 @@
                   .options("-J--class-path=" + System.getProperty("test.classes"),
                            "-J--add-exports=jdk.compiler/com.sun.tools.javac.platform=ALL-UNNAMED",
                            "-J--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
-                           "-release",
+                           "--release",
                            "fail",
                            System.getProperty("test.src") + "/PlatformProviderTestSource.java")
                   .run(Task.Expect.FAIL);
--- a/langtools/test/tools/javac/sym/ElementStructureTest.java	Tue Aug 30 17:47:46 2016 -0700
+++ b/langtools/test/tools/javac/sym/ElementStructureTest.java	Tue Aug 30 20:49:41 2016 -0700
@@ -255,7 +255,7 @@
     }
 
     void run(Writer output, String version) throws Exception {
-        List<String> options = Arrays.asList("-release", version, "-classpath", "");
+        List<String> options = Arrays.asList("--release", version, "-classpath", "");
         List<ToolBox.JavaSource> files = Arrays.asList(new ToolBox.JavaSource("Test", ""));
         JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
         JavacTaskImpl task = (JavacTaskImpl) compiler.getTask(null, null, null, options, null, files);
--- a/langtools/test/tools/javac/synthesize/Main.java	Tue Aug 30 17:47:46 2016 -0700
+++ b/langtools/test/tools/javac/synthesize/Main.java	Tue Aug 30 20:49:41 2016 -0700
@@ -99,7 +99,7 @@
         if (stdBootClassPath) {
             args.add("-Xmodule:java.base");
         } else {
-            args.add("-system");
+            args.add("--system");
             args.add("none");
             files.add("module-info.java");
         }
--- a/langtools/test/tools/javadoc/ReleaseOption.java	Tue Aug 30 17:47:46 2016 -0700
+++ b/langtools/test/tools/javadoc/ReleaseOption.java	Tue Aug 30 20:49:41 2016 -0700
@@ -34,7 +34,7 @@
 /**
  * @test
  * @bug 8086737
- * @summary Test -release option in javadoc
+ * @summary Test --release option in javadoc
  * @run main ReleaseOption
  */
 public class ReleaseOption {
@@ -43,10 +43,10 @@
     }
 
     void run() {
-        doRunTest(0, out -> out.contains("compiler.err.doesnt.exist: java.util.stream"), "-release", "7");
-        doRunTest(0, out -> !out.contains("compiler.err.doesnt.exist: java.util.stream"), "-release", "8");
-        doRunTest(1, out -> true, "-release", "7", "-source", "7");
-        doRunTest(1, out -> true, "-release", "7", "-bootclasspath", "any");
+        doRunTest(0, out -> out.contains("compiler.err.doesnt.exist: java.util.stream"), "--release", "7");
+        doRunTest(0, out -> !out.contains("compiler.err.doesnt.exist: java.util.stream"), "--release", "8");
+        doRunTest(1, out -> true, "--release", "7", "-source", "7");
+        doRunTest(1, out -> true, "--release", "7", "-bootclasspath", "any");
     }
 
     void doRunTest(int expectedResult, Predicate<String> validate, String... args) {
--- a/langtools/test/tools/lib/toolbox/ModuleBuilder.java	Tue Aug 30 17:47:46 2016 -0700
+++ b/langtools/test/tools/lib/toolbox/ModuleBuilder.java	Tue Aug 30 20:49:41 2016 -0700
@@ -205,7 +205,7 @@
                 .collect(Collectors.joining(File.pathSeparator));
         new JavacTask(tb)
                 .outdir(Files.createDirectories(modules.resolve(name)))
-                .options("-mp", mp)
+                .options("--module-path", mp)
                 .files(tb.findJavaFiles(moduleSrc))
                 .run()
                 .writeAll();