changeset 42841:1768507dae6b

8171412: tools/javac/modules/AddLimitMods.java failed with "error: module not found" Reviewed-by: mcimadamore
author jjg
date Tue, 20 Dec 2016 05:50:39 -0800
parents dfe1a03d4db4
children 2f0b2a65b284
files langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java langtools/test/ProblemList.txt langtools/test/tools/javac/modules/AddLimitMods.java
diffstat 3 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java	Mon Dec 19 12:30:39 2016 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java	Tue Dec 20 05:50:39 2016 -0800
@@ -62,7 +62,6 @@
 import com.sun.tools.javac.code.Directive.RequiresFlag;
 import com.sun.tools.javac.code.Directive.UsesDirective;
 import com.sun.tools.javac.code.Flags;
-import com.sun.tools.javac.code.Kinds;
 import com.sun.tools.javac.code.Lint.LintCategory;
 import com.sun.tools.javac.code.ModuleFinder;
 import com.sun.tools.javac.code.Source;
@@ -112,6 +111,7 @@
 import static com.sun.tools.javac.code.Flags.ENUM;
 import static com.sun.tools.javac.code.Flags.PUBLIC;
 import static com.sun.tools.javac.code.Flags.UNATTRIBUTED;
+import static com.sun.tools.javac.code.Kinds.Kind.ERR;
 import static com.sun.tools.javac.code.Kinds.Kind.MDL;
 import static com.sun.tools.javac.code.Kinds.Kind.MTH;
 import static com.sun.tools.javac.code.TypeTag.CLASS;
@@ -508,7 +508,7 @@
         public void complete(Symbol sym) throws CompletionFailure {
             ModuleSymbol msym = moduleFinder.findModule((ModuleSymbol) sym);
 
-            if (msym.kind == Kinds.Kind.ERR) {
+            if (msym.kind == ERR) {
                 log.error(Errors.ModuleNotFound(msym));
                 //make sure the module is initialized:
                 msym.directives = List.nil();
@@ -1073,7 +1073,8 @@
             }
         }
 
-        Predicate<ModuleSymbol> observablePred = sym -> observable == null || observable.contains(sym);
+        Predicate<ModuleSymbol> observablePred = sym ->
+             (observable == null) ? (moduleFinder.findModule(sym).kind != ERR) : observable.contains(sym);
         Predicate<ModuleSymbol> systemModulePred = sym -> (sym.flags() & Flags.SYSTEM_MODULE) != 0;
         Set<ModuleSymbol> enabledRoot = new LinkedHashSet<>();
 
--- a/langtools/test/ProblemList.txt	Mon Dec 19 12:30:39 2016 -0800
+++ b/langtools/test/ProblemList.txt	Tue Dec 20 05:50:39 2016 -0800
@@ -61,8 +61,6 @@
 tools/javac/warnings/suppress/TypeAnnotations.java                              8057683    generic-all    improve ordering of errors with type annotations
 tools/javac/modules/T8159439/NPEForModuleInfoWithNonZeroSuperClassTest.java     8160396    generic-all    current version of jtreg needs a new promotion to include lastes version of ASM
 
-tools/javac/modules/AddLimitMods.java						8171412    generic-all    tools/javac/modules/AddLimitMods.java failed with "error: module not found"
-
 ###########################################################################
 #
 # javap
--- a/langtools/test/tools/javac/modules/AddLimitMods.java	Mon Dec 19 12:30:39 2016 -0800
+++ b/langtools/test/tools/javac/modules/AddLimitMods.java	Tue Dec 20 05:50:39 2016 -0800
@@ -23,6 +23,7 @@
 
 /**
  * @test
+ * @bug 8142968 8154956 8170987 8171412
  * @summary Test --add-modules and --limit-modules; also test the "enabled" modules.
  * @library /tools/lib
  * @modules