changeset 3373:7c66438d4d8a

Setting UsesProviderCompleter to ModuleSymbol.usesProvidersCompleter, to avoid running it too soon.
author jlahoda
date Wed, 11 Nov 2015 15:27:26 -0800
parents 2c1838c6e03c
children 2e97a1c3478f 9adfacce560e
files src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java test/tools/javac/modules/AddReadsTest.java
diffstat 2 files changed, 36 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Tue Nov 10 14:19:14 2015 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Wed Nov 11 15:27:26 2015 -0800
@@ -2547,7 +2547,7 @@
             if (c == currentModule.module_info) {
                 if (interimUses.nonEmpty() || interimProvides.nonEmpty()) {
                     Assert.check(currentModule.isCompleted());
-                    currentModule.completer =
+                    currentModule.usesProvidesCompleter =
                             new UsesProvidesCompleter(currentModule, interimUses, interimProvides);
                 } else {
                     currentModule.uses = List.nil();
--- a/test/tools/javac/modules/AddReadsTest.java	Tue Nov 10 14:19:14 2015 -0800
+++ b/test/tools/javac/modules/AddReadsTest.java	Wed Nov 11 15:27:26 2015 -0800
@@ -267,4 +267,39 @@
 
         return jar;
     }
+
+    @Test
+    void testX(Path base) throws Exception {
+        Path src = base.resolve("src");
+        Path src_m1 = src.resolve("m1");
+        tb.writeJavaFiles(src_m1,
+                          "module m1 { provides java.lang.Runnable with impl.Impl; }",
+                          "package impl; public class Impl implements Runnable { public void run() { } }");
+        Path classes = base.resolve("classes");
+        tb.createDirectories(classes);
+
+        tb.new JavacTask()
+                .options("-modulesourcepath", src.toString())
+                .outdir(classes)
+                .files(findJavaFiles(src))
+                .run()
+                .writeAll();
+
+        Path unnamedSrc = base.resolve("unnamed-src");
+        Path unnamedClasses = base.resolve("unnamed-classes");
+
+        Files.createDirectories(unnamedClasses);
+
+        tb.writeJavaFiles(unnamedSrc,
+                          "package impl; public class Impl { }");
+
+        tb.new JavacTask()
+          .options("-XaddReads:m1=ALL-UNNAMED",
+                   "-Xmodule:m1",
+                   "-modulepath", classes.toString())
+          .outdir(unnamedClasses)
+          .files(findJavaFiles(unnamedSrc))
+          .run()
+          .writeAll();
+    }
 }