101 |
101 |
102 /** Access to files |
102 /** Access to files |
103 */ |
103 */ |
104 private final JavaFileManager fileManager; |
104 private final JavaFileManager fileManager; |
105 |
105 |
|
106 /** Dependency tracker |
|
107 */ |
|
108 private final Dependencies dependencies; |
|
109 |
106 /** Factory for diagnostics |
110 /** Factory for diagnostics |
107 */ |
111 */ |
108 JCDiagnostic.Factory diagFactory; |
112 JCDiagnostic.Factory diagFactory; |
109 |
113 |
110 /** Can be reassigned from outside: |
114 /** Can be reassigned from outside: |
148 context.put(classFinderKey, this); |
152 context.put(classFinderKey, this); |
149 reader = ClassReader.instance(context); |
153 reader = ClassReader.instance(context); |
150 names = Names.instance(context); |
154 names = Names.instance(context); |
151 syms = Symtab.instance(context); |
155 syms = Symtab.instance(context); |
152 fileManager = context.get(JavaFileManager.class); |
156 fileManager = context.get(JavaFileManager.class); |
|
157 dependencies = Dependencies.instance(context); |
153 if (fileManager == null) |
158 if (fileManager == null) |
154 throw new AssertionError("FileManager initialization error"); |
159 throw new AssertionError("FileManager initialization error"); |
155 diagFactory = JCDiagnostic.Factory.instance(context); |
160 diagFactory = JCDiagnostic.Factory.instance(context); |
156 |
161 |
157 log = Log.instance(context); |
162 log = Log.instance(context); |
177 /** Completion for classes to be loaded. Before a class is loaded |
182 /** Completion for classes to be loaded. Before a class is loaded |
178 * we make sure its enclosing class (if any) is loaded. |
183 * we make sure its enclosing class (if any) is loaded. |
179 */ |
184 */ |
180 private void complete(Symbol sym) throws CompletionFailure { |
185 private void complete(Symbol sym) throws CompletionFailure { |
181 if (sym.kind == TYP) { |
186 if (sym.kind == TYP) { |
182 ClassSymbol c = (ClassSymbol)sym; |
|
183 c.members_field = new Scope.ErrorScope(c); // make sure it's always defined |
|
184 annotate.enterStart(); |
|
185 try { |
187 try { |
186 completeOwners(c.owner); |
188 ClassSymbol c = (ClassSymbol) sym; |
187 completeEnclosing(c); |
189 dependencies.push(c); |
|
190 c.members_field = new Scope.ErrorScope(c); // make sure it's always defined |
|
191 annotate.enterStart(); |
|
192 try { |
|
193 completeOwners(c.owner); |
|
194 completeEnclosing(c); |
|
195 } finally { |
|
196 // The flush needs to happen only after annotations |
|
197 // are filled in. |
|
198 annotate.enterDoneWithoutFlush(); |
|
199 } |
|
200 fillIn(c); |
188 } finally { |
201 } finally { |
189 // The flush needs to happen only after annotations |
202 dependencies.pop(); |
190 // are filled in. |
203 } |
191 annotate.enterDoneWithoutFlush(); |
|
192 } |
|
193 fillIn(c); |
|
194 } else if (sym.kind == PCK) { |
204 } else if (sym.kind == PCK) { |
195 PackageSymbol p = (PackageSymbol)sym; |
205 PackageSymbol p = (PackageSymbol)sym; |
196 try { |
206 try { |
197 fillIn(p); |
207 fillIn(p); |
198 } catch (IOException ex) { |
208 } catch (IOException ex) { |