langtools/src/share/classes/com/sun/tools/javac/code/ClassFinder.java
changeset 25844 48eab270456c
parent 25443 9187d77f2c64
equal deleted inserted replaced
25699:7ca97d2d0405 25844:48eab270456c
   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) {
   255                     } else {
   265                     } else {
   256                         throw new IllegalStateException("Source completer required to read "
   266                         throw new IllegalStateException("Source completer required to read "
   257                                                         + classfile.toUri());
   267                                                         + classfile.toUri());
   258                     }
   268                     }
   259                 }
   269                 }
   260                 return;
       
   261             } finally {
   270             } finally {
   262                 currentClassFile = previousClassFile;
   271                 currentClassFile = previousClassFile;
   263             }
   272             }
   264         } else {
   273         } else {
   265             JCDiagnostic diag =
   274             JCDiagnostic diag =