8307563: make most fields final in JavacTrees
Reviewed-by: vromero
This commit is contained in:
parent
f250ab2c2a
commit
958d4a7505
@ -155,25 +155,24 @@ import static com.sun.tools.javac.code.Kinds.Kind.*;
|
||||
* @author Peter von der Ahé
|
||||
*/
|
||||
public class JavacTrees extends DocTrees {
|
||||
private final Modules modules;
|
||||
private final Resolve resolve;
|
||||
private final Enter enter;
|
||||
private final Log log;
|
||||
private final MemberEnter memberEnter;
|
||||
private final Attr attr;
|
||||
private final Check chk;
|
||||
private final TreeMaker treeMaker;
|
||||
private final JavacElements elements;
|
||||
private final JavacTaskImpl javacTaskImpl;
|
||||
private final Names names;
|
||||
private final Types types;
|
||||
private final DocTreeMaker docTreeMaker;
|
||||
private final JavaFileManager fileManager;
|
||||
private final ParserFactory parser;
|
||||
private final Symtab syms;
|
||||
|
||||
// in a world of a single context per compilation, these would all be final
|
||||
private Modules modules;
|
||||
private Resolve resolve;
|
||||
private Enter enter;
|
||||
private Log log;
|
||||
private MemberEnter memberEnter;
|
||||
private Attr attr;
|
||||
private Check chk;
|
||||
private TreeMaker treeMaker;
|
||||
private JavacElements elements;
|
||||
private JavacTaskImpl javacTaskImpl;
|
||||
private Names names;
|
||||
private Types types;
|
||||
private DocTreeMaker docTreeMaker;
|
||||
private BreakIterator breakIterator;
|
||||
private JavaFileManager fileManager;
|
||||
private ParserFactory parser;
|
||||
private Symtab syms;
|
||||
|
||||
private final Map<Type, Type> extraType2OriginalMap = new WeakHashMap<>();
|
||||
|
||||
@ -202,14 +201,7 @@ public class JavacTrees extends DocTrees {
|
||||
protected JavacTrees(Context context) {
|
||||
this.breakIterator = null;
|
||||
context.put(JavacTrees.class, this);
|
||||
init(context);
|
||||
}
|
||||
|
||||
public void updateContext(Context context) {
|
||||
init(context);
|
||||
}
|
||||
|
||||
private void init(Context context) {
|
||||
modules = Modules.instance(context);
|
||||
attr = Attr.instance(context);
|
||||
chk = Check.instance(context);
|
||||
@ -225,9 +217,8 @@ public class JavacTrees extends DocTrees {
|
||||
parser = ParserFactory.instance(context);
|
||||
syms = Symtab.instance(context);
|
||||
fileManager = context.get(JavaFileManager.class);
|
||||
JavacTask t = context.get(JavacTask.class);
|
||||
if (t instanceof JavacTaskImpl taskImpl)
|
||||
javacTaskImpl = taskImpl;
|
||||
var task = context.get(JavacTask.class);
|
||||
javacTaskImpl = (task instanceof JavacTaskImpl taskImpl) ? taskImpl : null;
|
||||
}
|
||||
|
||||
@Override @DefinedBy(Api.COMPILER_TREE)
|
||||
|
Loading…
x
Reference in New Issue
Block a user