80 protected static final Context.Key<Annotate> annotateKey = new Context.Key<>();
81
82 public static Annotate instance(Context context) {
83 Annotate instance = context.get(annotateKey);
84 if (instance == null)
85 instance = new Annotate(context);
86 return instance;
87 }
88
89 private final Attr attr;
90 private final Check chk;
91 private final ConstFold cfolder;
92 private final Enter enter;
93 private final Log log;
94 private final Names names;
95 private final Resolve resolve;
96 private final TreeMaker make;
97 private final Symtab syms;
98 private final TypeEnvs typeEnvs;
99 private final Types types;
100
101 private final Attribute theUnfinishedDefaultValue;
102 private final String sourceName;
103
104 @SuppressWarnings("this-escape")
105 protected Annotate(Context context) {
106 context.put(annotateKey, this);
107
108 attr = Attr.instance(context);
109 chk = Check.instance(context);
110 cfolder = ConstFold.instance(context);
111 enter = Enter.instance(context);
112 log = Log.instance(context);
113 make = TreeMaker.instance(context);
114 names = Names.instance(context);
115 resolve = Resolve.instance(context);
116 syms = Symtab.instance(context);
117 typeEnvs = TypeEnvs.instance(context);
118 types = Types.instance(context);
119
120 theUnfinishedDefaultValue = new Attribute.Error(syms.errType);
121
122 Source source = Source.instance(context);
123 sourceName = source.name;
124
125 blockCount = 1;
126 }
127
128 /** Semaphore to delay annotation processing */
129 private int blockCount = 0;
130
131 /** Called when annotations processing needs to be postponed. */
132 public void blockAnnotations() {
133 blockCount++;
134 }
135
136 /** Called when annotation processing can be resumed. */
137 public void unblockAnnotations() {
138 blockCount--;
|
80 protected static final Context.Key<Annotate> annotateKey = new Context.Key<>();
81
82 public static Annotate instance(Context context) {
83 Annotate instance = context.get(annotateKey);
84 if (instance == null)
85 instance = new Annotate(context);
86 return instance;
87 }
88
89 private final Attr attr;
90 private final Check chk;
91 private final ConstFold cfolder;
92 private final Enter enter;
93 private final Log log;
94 private final Names names;
95 private final Resolve resolve;
96 private final TreeMaker make;
97 private final Symtab syms;
98 private final TypeEnvs typeEnvs;
99 private final Types types;
100 private final Preview preview;
101
102 private final Attribute theUnfinishedDefaultValue;
103 private final String sourceName;
104
105 @SuppressWarnings("this-escape")
106 protected Annotate(Context context) {
107 context.put(annotateKey, this);
108
109 attr = Attr.instance(context);
110 chk = Check.instance(context);
111 cfolder = ConstFold.instance(context);
112 enter = Enter.instance(context);
113 log = Log.instance(context);
114 make = TreeMaker.instance(context);
115 names = Names.instance(context);
116 resolve = Resolve.instance(context);
117 syms = Symtab.instance(context);
118 typeEnvs = TypeEnvs.instance(context);
119 types = Types.instance(context);
120 preview = Preview.instance(context);
121
122 theUnfinishedDefaultValue = new Attribute.Error(syms.errType);
123
124 Source source = Source.instance(context);
125 sourceName = source.name;
126
127 blockCount = 1;
128 }
129
130 /** Semaphore to delay annotation processing */
131 private int blockCount = 0;
132
133 /** Called when annotations processing needs to be postponed. */
134 public void blockAnnotations() {
135 blockCount++;
136 }
137
138 /** Called when annotation processing can be resumed. */
139 public void unblockAnnotations() {
140 blockCount--;
|