< prev index next >

src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java

Print this page




 286     /** The name table.
 287      */
 288     protected Names names;
 289 
 290     /** The attributor.
 291      */
 292     protected Attr attr;
 293 
 294     /** The analyzer
 295      */
 296     protected Analyzer analyzer;
 297 
 298     /** The attributor.
 299      */
 300     protected Check chk;
 301 
 302     /** The flow analyzer.
 303      */
 304     protected Flow flow;
 305 




 306     /** The modules visitor
 307      */
 308     protected Modules modules;
 309 
 310     /** The module finder
 311      */
 312     protected ModuleFinder moduleFinder;
 313 
 314     /** The diagnostics factory
 315      */
 316     protected JCDiagnostic.Factory diags;
 317 
 318     protected DeferredCompletionFailureHandler dcfh;
 319 
 320     /** The type eraser.
 321      */
 322     protected TransTypes transTypes;
 323 
 324     /** The syntactic sugar desweetener.
 325      */


 398         todo = Todo.instance(context);
 399 
 400         fileManager = context.get(JavaFileManager.class);
 401         parserFactory = ParserFactory.instance(context);
 402         compileStates = CompileStates.instance(context);
 403 
 404         try {
 405             // catch completion problems with predefineds
 406             syms = Symtab.instance(context);
 407         } catch (CompletionFailure ex) {
 408             // inlined Check.completionError as it is not initialized yet
 409             log.error(Errors.CantAccess(ex.sym, ex.getDetailValue()));
 410         }
 411         source = Source.instance(context);
 412         preview = Preview.instance(context);
 413         attr = Attr.instance(context);
 414         analyzer = Analyzer.instance(context);
 415         chk = Check.instance(context);
 416         gen = Gen.instance(context);
 417         flow = Flow.instance(context);

 418         transTypes = TransTypes.instance(context);
 419         lower = Lower.instance(context);
 420         annotate = Annotate.instance(context);
 421         types = Types.instance(context);
 422         taskListener = MultiTaskListener.instance(context);
 423         modules = Modules.instance(context);
 424         moduleFinder = ModuleFinder.instance(context);
 425         diags = Factory.instance(context);
 426         dcfh = DeferredCompletionFailureHandler.instance(context);
 427 
 428         finder.sourceCompleter = sourceCompleter;
 429         modules.findPackageInFile = this::findPackageInFile;
 430         moduleFinder.moduleNameFromSourceReader = this::readModuleName;
 431 
 432         options = Options.instance(context);
 433 
 434         verbose       = options.isSet(VERBOSE);
 435         sourceOutput  = options.isSet(PRINTSOURCE); // used to be -s
 436         lineDebugInfo = options.isUnset(G_CUSTOM) ||
 437                         options.isSet(G_CUSTOM, "lines");


1393         try {
1394             if (shouldStop(CompileState.FLOW))
1395                 return;
1396 
1397             if (verboseCompilePolicy)
1398                 printNote("[flow " + env.enclClass.sym + "]");
1399             JavaFileObject prev = log.useSource(
1400                                                 env.enclClass.sym.sourcefile != null ?
1401                                                 env.enclClass.sym.sourcefile :
1402                                                 env.toplevel.sourcefile);
1403             try {
1404                 make.at(Position.FIRSTPOS);
1405                 TreeMaker localMake = make.forToplevel(env.toplevel);
1406                 flow.analyzeTree(env, localMake);
1407                 compileStates.put(env, CompileState.FLOW);
1408 
1409                 if (shouldStop(CompileState.FLOW))
1410                     return;
1411 
1412                 analyzer.flush(env);


1413 
1414                 results.add(env);
1415             }
1416             finally {
1417                 log.useSource(prev);
1418             }
1419         }
1420         finally {
1421             if (!taskListener.isEmpty()) {
1422                 TaskEvent e = new TaskEvent(TaskEvent.Kind.ANALYZE, env.toplevel, env.enclClass.sym);
1423                 taskListener.finished(e);
1424             }
1425         }
1426     }
1427 
1428     /**
1429      * Prepare attributed parse trees, in conjunction with their attribution contexts,
1430      * for source or code generation.
1431      * If any errors occur, an empty list will be returned.
1432      * @return a list containing the classes to be generated




 286     /** The name table.
 287      */
 288     protected Names names;
 289 
 290     /** The attributor.
 291      */
 292     protected Attr attr;
 293 
 294     /** The analyzer
 295      */
 296     protected Analyzer analyzer;
 297 
 298     /** The attributor.
 299      */
 300     protected Check chk;
 301 
 302     /** The flow analyzer.
 303      */
 304     protected Flow flow;
 305 
 306     /** The constables analyzer.
 307      */
 308     protected ConstablesVisitor constablesVisitor;
 309 
 310     /** The modules visitor
 311      */
 312     protected Modules modules;
 313 
 314     /** The module finder
 315      */
 316     protected ModuleFinder moduleFinder;
 317 
 318     /** The diagnostics factory
 319      */
 320     protected JCDiagnostic.Factory diags;
 321 
 322     protected DeferredCompletionFailureHandler dcfh;
 323 
 324     /** The type eraser.
 325      */
 326     protected TransTypes transTypes;
 327 
 328     /** The syntactic sugar desweetener.
 329      */


 402         todo = Todo.instance(context);
 403 
 404         fileManager = context.get(JavaFileManager.class);
 405         parserFactory = ParserFactory.instance(context);
 406         compileStates = CompileStates.instance(context);
 407 
 408         try {
 409             // catch completion problems with predefineds
 410             syms = Symtab.instance(context);
 411         } catch (CompletionFailure ex) {
 412             // inlined Check.completionError as it is not initialized yet
 413             log.error(Errors.CantAccess(ex.sym, ex.getDetailValue()));
 414         }
 415         source = Source.instance(context);
 416         preview = Preview.instance(context);
 417         attr = Attr.instance(context);
 418         analyzer = Analyzer.instance(context);
 419         chk = Check.instance(context);
 420         gen = Gen.instance(context);
 421         flow = Flow.instance(context);
 422         constablesVisitor = ConstablesVisitor.instance(context);
 423         transTypes = TransTypes.instance(context);
 424         lower = Lower.instance(context);
 425         annotate = Annotate.instance(context);
 426         types = Types.instance(context);
 427         taskListener = MultiTaskListener.instance(context);
 428         modules = Modules.instance(context);
 429         moduleFinder = ModuleFinder.instance(context);
 430         diags = Factory.instance(context);
 431         dcfh = DeferredCompletionFailureHandler.instance(context);
 432 
 433         finder.sourceCompleter = sourceCompleter;
 434         modules.findPackageInFile = this::findPackageInFile;
 435         moduleFinder.moduleNameFromSourceReader = this::readModuleName;
 436 
 437         options = Options.instance(context);
 438 
 439         verbose       = options.isSet(VERBOSE);
 440         sourceOutput  = options.isSet(PRINTSOURCE); // used to be -s
 441         lineDebugInfo = options.isUnset(G_CUSTOM) ||
 442                         options.isSet(G_CUSTOM, "lines");


1398         try {
1399             if (shouldStop(CompileState.FLOW))
1400                 return;
1401 
1402             if (verboseCompilePolicy)
1403                 printNote("[flow " + env.enclClass.sym + "]");
1404             JavaFileObject prev = log.useSource(
1405                                                 env.enclClass.sym.sourcefile != null ?
1406                                                 env.enclClass.sym.sourcefile :
1407                                                 env.toplevel.sourcefile);
1408             try {
1409                 make.at(Position.FIRSTPOS);
1410                 TreeMaker localMake = make.forToplevel(env.toplevel);
1411                 flow.analyzeTree(env, localMake);
1412                 compileStates.put(env, CompileState.FLOW);
1413 
1414                 if (shouldStop(CompileState.FLOW))
1415                     return;
1416 
1417                 analyzer.flush(env);
1418 
1419                 env.tree = constablesVisitor.analyzeTree(env.tree, env);
1420 
1421                 results.add(env);
1422             }
1423             finally {
1424                 log.useSource(prev);
1425             }
1426         }
1427         finally {
1428             if (!taskListener.isEmpty()) {
1429                 TaskEvent e = new TaskEvent(TaskEvent.Kind.ANALYZE, env.toplevel, env.enclClass.sym);
1430                 taskListener.finished(e);
1431             }
1432         }
1433     }
1434 
1435     /**
1436      * Prepare attributed parse trees, in conjunction with their attribution contexts,
1437      * for source or code generation.
1438      * If any errors occur, an empty list will be returned.
1439      * @return a list containing the classes to be generated


< prev index next >