langtools/test/tools/javac/T6358166.java
changeset 37848 3c8ff4204d2d
parent 36526 3b41f1c69604
child 40308 274367a99f98
--- a/langtools/test/tools/javac/T6358166.java	Thu Apr 28 08:26:42 2016 -0700
+++ b/langtools/test/tools/javac/T6358166.java	Tue May 03 09:11:12 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2016, 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
@@ -42,8 +42,7 @@
 import com.sun.tools.javac.api.JavacTool;
 import com.sun.tools.javac.file.JavacFileManager;
 import com.sun.tools.javac.main.JavaCompiler;
-import com.sun.tools.javac.util.*;
-import com.sun.tools.javac.util.List; // disambiguate
+import com.sun.tools.javac.util.Context;
 
 
 @SupportedAnnotationTypes("*")
@@ -56,22 +55,26 @@
         JavacFileManager fm = new JavacFileManager(new Context(), false, null);
         JavaFileObject f = fm.getJavaFileObject(testSrc + File.separatorChar + self + ".java");
 
-        String addExports = "-XaddExports:"
-                + "jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED,"
-                + "jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED,"
-                + "jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED,"
-                + "jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED";
+        List<String> addExports = Arrays.asList(
+                "-XaddExports:jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED",
+                "-XaddExports:jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED",
+                "-XaddExports:jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED",
+                "-XaddExports:jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED");
 
         test(fm, f, addExports, "-verbose", "-d", ".");
 
         test(fm, f, addExports, "-verbose", "-d", ".", "-XprintRounds", "-processorpath", ".", "-processor", self);
     }
 
-    static void test(JavacFileManager fm, JavaFileObject f, String... args) throws Throwable {
+    static void test(JavacFileManager fm, JavaFileObject f, List<String> addExports, String... args) throws Throwable {
+        List<String> allArgs = new ArrayList<>();
+        allArgs.addAll(addExports);
+        allArgs.addAll(Arrays.asList(args));
+
         Context context = new Context();
 
         JavacTool tool = JavacTool.create();
-        JavacTaskImpl task = (JavacTaskImpl) tool.getTask(null, fm, null, Arrays.asList(args), null, List.of(f), context);
+        JavacTaskImpl task = (JavacTaskImpl) tool.getTask(null, fm, null, allArgs, null, List.of(f), context);
         task.call();
 
         JavaCompiler c = JavaCompiler.instance(context);