langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Analyzer.java
changeset 44393 ce94820fa9d1
parent 34474 14deea5f86f1
child 45504 ea7475564d07
equal deleted inserted replaced
44392:e21b18355690 44393:ce94820fa9d1
     1 /*
     1 /*
     2  * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
   360             //add a block to hoist potential dangling variable declarations
   360             //add a block to hoist potential dangling variable declarations
   361             JCBlock fakeBlock = make.Block(SYNTHETIC, List.of(statement));
   361             JCBlock fakeBlock = make.Block(SYNTHETIC, List.of(statement));
   362 
   362 
   363             TreeMapper treeMapper = new TreeMapper(context);
   363             TreeMapper treeMapper = new TreeMapper(context);
   364             //TODO: to further refine the analysis, try all rewriting combinations
   364             //TODO: to further refine the analysis, try all rewriting combinations
   365             LocalCacheContext localCacheContext = argumentAttr.withLocalCacheContext();
   365             deferredAttr.attribSpeculative(fakeBlock, env, attr.statInfo, treeMapper,
   366             try {
   366                     t -> new AnalyzeDeferredDiagHandler(context),
   367                 deferredAttr.attribSpeculative(fakeBlock, env, attr.statInfo, treeMapper,
   367                     argumentAttr.withLocalCacheContext());
   368                         t -> new AnalyzeDeferredDiagHandler(context));
       
   369             } finally {
       
   370                 localCacheContext.leave();
       
   371             }
       
   372 
       
   373             context.treeMap.entrySet().forEach(e -> {
   368             context.treeMap.entrySet().forEach(e -> {
   374                 context.treesToAnalyzer.get(e.getKey())
   369                 context.treesToAnalyzer.get(e.getKey())
   375                         .process(e.getKey(), e.getValue(), context.errors.nonEmpty());
   370                         .process(e.getKey(), e.getValue(), context.errors.nonEmpty());
   376             });
   371             });
   377         }
   372         }