< prev index next >

test/tools/javac/modules/ModuleInfoTreeAccess.java

Print this page

        

@@ -44,11 +44,10 @@
 import com.sun.source.doctree.DocCommentTree;
 import com.sun.source.util.JavacTask;
 import com.sun.source.util.TreePath;
 import com.sun.tools.javac.api.JavacTrees;
 
-import toolbox.ToolBox;
 
 public class ModuleInfoTreeAccess extends ModuleTestBase {
     public static void main(String... args) throws Exception {
         ModuleInfoTreeAccess t = new ModuleInfoTreeAccess();
         t.runTests();

@@ -64,18 +63,18 @@
     public void testTreePathForModuleDecl(Path base) throws Exception {
 
         JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
         try (StandardJavaFileManager fm = compiler.getStandardFileManager(null, null, null)) {
             Path src = base.resolve("src");
-            tb.writeJavaFiles(src, "/** Test module */ module m1 {}");
+            tb.writeJavaFiles(src, "/** Test module */ module m1x {}");
 
             Iterable<? extends JavaFileObject> files = fm.getJavaFileObjects(findJavaFiles(src));
             JavacTask task = (JavacTask) compiler.getTask(null, fm, null, null, null, files);
 
             task.analyze();
             JavacTrees trees = JavacTrees.instance(task);
-            ModuleElement mdle = (ModuleElement) task.getElements().getModuleElement("m1");
+            ModuleElement mdle = (ModuleElement) task.getElements().getModuleElement("m1x");
 
             TreePath path = trees.getPath(mdle);
             assertNotNull("path", path);
 
             ModuleElement mdle1 = (ModuleElement) trees.getElement(path);

@@ -89,18 +88,18 @@
     @Test
     public void testTreePathForModuleDeclWithImport(Path base) throws Exception {
         JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
         try (StandardJavaFileManager fm = compiler.getStandardFileManager(null, null, null)) {
             Path src = base.resolve("src");
-            tb.writeJavaFiles(src, "import java.lang.Deprecated; /** Test module */ @Deprecated module m1 {}");
+            tb.writeJavaFiles(src, "import java.lang.Deprecated; /** Test module */ @Deprecated module m1x {}");
 
             Iterable<? extends JavaFileObject> files = fm.getJavaFileObjects(findJavaFiles(src));
             JavacTask task = (JavacTask) compiler.getTask(null, fm, null, null, null, files);
 
             task.analyze();
             JavacTrees trees = JavacTrees.instance(task);
-            ModuleElement mdle = (ModuleElement) task.getElements().getModuleElement("m1");
+            ModuleElement mdle = (ModuleElement) task.getElements().getModuleElement("m1x");
 
             TreePath path = trees.getPath(mdle);
             assertNotNull("path", path);
 
             ModuleElement mdle1 = (ModuleElement) trees.getElement(path);
< prev index next >