changeset 4175:cbc5f0fe29a7

A hotfix to module info processing order so that make docs works
author jlahoda
date Fri, 12 Aug 2016 22:50:05 +0200
parents 0aa1c15fd0c3
children a579a4ceb686 8bd01d119749
files src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java
diffstat 2 files changed, 18 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java	Thu Aug 11 18:52:55 2016 -0700
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java	Fri Aug 12 22:50:05 2016 +0200
@@ -167,6 +167,9 @@
      */
     ListBuffer<ClassSymbol> uncompleted;
 
+    public boolean modulesInitialized;
+    ListBuffer<JCCompilationUnit> unfinishedModules = new ListBuffer<>();
+
     /** A dummy class to serve as enclClass for toplevel environments.
      */
     private JCClassDecl predefClassDef;
@@ -554,7 +557,19 @@
                         prevUncompleted.append(clazz);
                 }
 
-                typeEnter.ensureImportsChecked(trees);
+                if (!modulesInitialized) {
+                    for (JCCompilationUnit cut : trees) {
+                        if (cut.getModuleDecl() != null) {
+                            unfinishedModules.append(cut);
+                        } else {
+                            typeEnter.ensureImportsChecked(List.of(cut));
+                        }
+                    }
+                } else {
+                    typeEnter.ensureImportsChecked(unfinishedModules.toList());
+                    unfinishedModules.clear();
+                    typeEnter.ensureImportsChecked(trees);
+                }
             }
         } finally {
             uncompleted = prevUncompleted;
@@ -564,5 +579,6 @@
 
     public void newRound() {
         typeEnvs.clear();
+        modulesInitialized = false;
     }
 }
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Thu Aug 11 18:52:55 2016 -0700
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Fri Aug 12 22:50:05 2016 +0200
@@ -1011,6 +1011,7 @@
 
     public List<JCCompilationUnit> initModules(List<JCCompilationUnit> roots) {
         modules.initModules(roots, Collections.emptySet(), Collections.emptySet());
+        enter.modulesInitialized = true;
         if (roots.isEmpty()) {
             enterDone = true;
         }