32 import com.sun.tools.javac.comp.DeferredAttr.AttributionMode;
33
34 /** Contains information specific to the attribute and enter
35 * passes, to be used in place of the generic field in environments.
36 *
37 * <p><b>This is NOT part of any supported API.
38 * If you write code that depends on this, you do so at your own risk.
39 * This code and its internal interfaces are subject to change or
40 * deletion without notice.</b>
41 */
42 public class AttrContext {
43
44 /** The scope of local symbols.
45 */
46 WriteableScope scope = null;
47
48 /** The number of enclosing `static' modifiers.
49 */
50 int staticLevel = 0;
51
52 /** Are we in the 'prologue' part of a constructor, prior to an explicit this()/super()?
53 */
54 boolean ctorPrologue = false;
55
56 /** Are we evaluating the selector of a `super' or type name?
57 */
58 boolean selectSuper = false;
59
60 /** Is the current target of lambda expression or method reference serializable or is this a
61 * serializable class?
62 */
63 boolean isSerializable = false;
64
65 /** Is this a serializable lambda?
66 */
67 boolean isSerializableLambda = false;
68
69 /** Is this a lambda environment?
70 */
71 boolean isLambda = false;
72
73 /** Is this a speculative attribution environment?
74 */
119 */
120 Attr.ResultInfo yieldResult = null;
121
122 /** Symbol corresponding to the site of a qualified default super call
123 */
124 Type defaultSuperCallSite = null;
125
126 /** Tree that when non null, is to be preferentially used in diagnostics.
127 * Usually Env<AttrContext>.tree is the tree to be referred to in messages,
128 * but this may not be true during the window a method is looked up in enclosing
129 * contexts (JDK-8145466)
130 */
131 JCTree preferredTreeForDiagnostics;
132
133 /** Duplicate this context, replacing scope field and copying all others.
134 */
135 AttrContext dup(WriteableScope scope) {
136 AttrContext info = new AttrContext();
137 info.scope = scope;
138 info.staticLevel = staticLevel;
139 info.ctorPrologue = ctorPrologue;
140 info.selectSuper = selectSuper;
141 info.pendingResolutionPhase = pendingResolutionPhase;
142 info.lint = lint;
143 info.enclVar = enclVar;
144 info.returnResult = returnResult;
145 info.yieldResult = yieldResult;
146 info.defaultSuperCallSite = defaultSuperCallSite;
147 info.isSerializable = isSerializable;
148 info.isLambda = isLambda;
149 info.isSerializableLambda = isSerializableLambda;
150 info.attributionMode = attributionMode;
151 info.isAnonymousDiamond = isAnonymousDiamond;
152 info.isAnonymousNewClass = isAnonymousNewClass;
153 info.preferredTreeForDiagnostics = preferredTreeForDiagnostics;
154 info.visitingServiceImplementation = visitingServiceImplementation;
155 info.allowProtectedAccess = allowProtectedAccess;
156 info.isPermitsClause = isPermitsClause;
157 return info;
158 }
159
|
32 import com.sun.tools.javac.comp.DeferredAttr.AttributionMode;
33
34 /** Contains information specific to the attribute and enter
35 * passes, to be used in place of the generic field in environments.
36 *
37 * <p><b>This is NOT part of any supported API.
38 * If you write code that depends on this, you do so at your own risk.
39 * This code and its internal interfaces are subject to change or
40 * deletion without notice.</b>
41 */
42 public class AttrContext {
43
44 /** The scope of local symbols.
45 */
46 WriteableScope scope = null;
47
48 /** The number of enclosing `static' modifiers.
49 */
50 int staticLevel = 0;
51
52 /** Early construction context.
53 */
54 EarlyConstructionContext earlyContext = EarlyConstructionContext.NONE;
55
56 /** Are we evaluating the selector of a `super' or type name?
57 */
58 boolean selectSuper = false;
59
60 /** Is the current target of lambda expression or method reference serializable or is this a
61 * serializable class?
62 */
63 boolean isSerializable = false;
64
65 /** Is this a serializable lambda?
66 */
67 boolean isSerializableLambda = false;
68
69 /** Is this a lambda environment?
70 */
71 boolean isLambda = false;
72
73 /** Is this a speculative attribution environment?
74 */
119 */
120 Attr.ResultInfo yieldResult = null;
121
122 /** Symbol corresponding to the site of a qualified default super call
123 */
124 Type defaultSuperCallSite = null;
125
126 /** Tree that when non null, is to be preferentially used in diagnostics.
127 * Usually Env<AttrContext>.tree is the tree to be referred to in messages,
128 * but this may not be true during the window a method is looked up in enclosing
129 * contexts (JDK-8145466)
130 */
131 JCTree preferredTreeForDiagnostics;
132
133 /** Duplicate this context, replacing scope field and copying all others.
134 */
135 AttrContext dup(WriteableScope scope) {
136 AttrContext info = new AttrContext();
137 info.scope = scope;
138 info.staticLevel = staticLevel;
139 info.earlyContext = earlyContext;
140 info.selectSuper = selectSuper;
141 info.pendingResolutionPhase = pendingResolutionPhase;
142 info.lint = lint;
143 info.enclVar = enclVar;
144 info.returnResult = returnResult;
145 info.yieldResult = yieldResult;
146 info.defaultSuperCallSite = defaultSuperCallSite;
147 info.isSerializable = isSerializable;
148 info.isLambda = isLambda;
149 info.isSerializableLambda = isSerializableLambda;
150 info.attributionMode = attributionMode;
151 info.isAnonymousDiamond = isAnonymousDiamond;
152 info.isAnonymousNewClass = isAnonymousNewClass;
153 info.preferredTreeForDiagnostics = preferredTreeForDiagnostics;
154 info.visitingServiceImplementation = visitingServiceImplementation;
155 info.allowProtectedAccess = allowProtectedAccess;
156 info.isPermitsClause = isPermitsClause;
157 return info;
158 }
159
|