--- a/langtools/test/tools/javac/api/T6358786.java Tue Mar 15 13:48:30 2016 -0700
+++ b/langtools/test/tools/javac/api/T6358786.java Thu Mar 17 19:04:28 2016 +0000
@@ -30,15 +30,15 @@
* @run main T6358786 T6358786.java
*/
-import com.sun.tools.javac.api.JavacTaskImpl;
-import com.sun.tools.javac.file.JavacFileManager;
-import java.util.Arrays;
+import java.io.*;
+import java.util.*;
+import javax.lang.model.element.Element;
import javax.lang.model.util.Elements;
-import java.io.*;
-import javax.lang.model.element.TypeElement;
import javax.tools.*;
+import com.sun.tools.javac.api.JavacTaskImpl;
+
/**
* Tests that doccomments are available from the Tree API.
*/
@@ -48,9 +48,12 @@
try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) {
String srcdir = System.getProperty("test.src");
File file = new File(srcdir, args[0]);
- JavacTaskImpl task = (JavacTaskImpl)tool.getTask(null, fm, null, null, null, fm.getJavaFileObjectsFromFiles(Arrays.asList(file)));
+ List<String> options = Arrays.asList(
+ "-XaddExports:jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED"
+ );
+ JavacTaskImpl task = (JavacTaskImpl)tool.getTask(null, fm, null, options, null, fm.getJavaFileObjectsFromFiles(Arrays.asList(file)));
Elements elements = task.getElements();
- for (TypeElement clazz : task.enter(task.parse())) {
+ for (Element clazz : task.enter(task.parse())) {
String doc = elements.getDocComment(clazz);
if (doc == null)
throw new AssertionError(clazz.getSimpleName() + ": no doc comment");