src/share/classes/com/sun/tools/javac/code/TypeAnnotationPosition.java

changeset 1755
ddb4a2bfcd82
parent 1563
bc456436c613
child 2047
5f915a0c9615
equal deleted inserted replaced
1754:0384683c64be 1755:ddb4a2bfcd82
25 25
26 package com.sun.tools.javac.code; 26 package com.sun.tools.javac.code;
27 27
28 import java.util.Iterator; 28 import java.util.Iterator;
29 29
30 import com.sun.tools.javac.tree.JCTree.JCLambda;
30 import com.sun.tools.javac.util.*; 31 import com.sun.tools.javac.util.*;
31 32
32 /** A type annotation position. 33 /** A type annotation position.
33 * 34 *
34 * <p><b>This is NOT part of any supported API. 35 * <p><b>This is NOT part of any supported API.
143 public int parameter_index = Integer.MIN_VALUE; 144 public int parameter_index = Integer.MIN_VALUE;
144 145
145 // For class extends, implements, and throws clauses 146 // For class extends, implements, and throws clauses
146 public int type_index = Integer.MIN_VALUE; 147 public int type_index = Integer.MIN_VALUE;
147 148
148 // For exception parameters, index into exception table 149 // For exception parameters, index into exception table.
150 // In com.sun.tools.javac.jvm.Gen.genCatch we first set the type_index
151 // to the catch type index - that value is only temporary.
152 // Then in com.sun.tools.javac.jvm.Code.fillExceptionParameterPositions
153 // we use that value to determine the exception table index.
149 public int exception_index = Integer.MIN_VALUE; 154 public int exception_index = Integer.MIN_VALUE;
155
156 // If this type annotation is within a lambda expression,
157 // store a pointer to the lambda expression tree in order
158 // to allow a later translation to the right method.
159 public JCLambda onLambda = null;
150 160
151 public TypeAnnotationPosition() {} 161 public TypeAnnotationPosition() {}
152 162
153 @Override 163 @Override
154 public String toString() { 164 public String toString() {
256 } 266 }
257 267
258 sb.append(", pos = "); 268 sb.append(", pos = ");
259 sb.append(pos); 269 sb.append(pos);
260 270
271 if (onLambda != null) {
272 sb.append(", onLambda hash = ");
273 sb.append(onLambda.hashCode());
274 }
275
261 sb.append(']'); 276 sb.append(']');
262 return sb.toString(); 277 return sb.toString();
263 } 278 }
264 279
265 /** 280 /**
267 * away from classfile or not. 282 * away from classfile or not.
268 * @return true if the target has not been optimized away 283 * @return true if the target has not been optimized away
269 */ 284 */
270 public boolean emitToClassfile() { 285 public boolean emitToClassfile() {
271 return !type.isLocal() || isValidOffset; 286 return !type.isLocal() || isValidOffset;
287 }
288
289
290 public boolean matchesPos(int pos) {
291 return this.pos == pos;
292 }
293
294 public void updatePosOffset(int to) {
295 offset = to;
296 lvarOffset = new int[]{to};
297 isValidOffset = true;
272 } 298 }
273 299
274 /** 300 /**
275 * Decode the binary representation for a type path and set 301 * Decode the binary representation for a type path and set
276 * the {@code location} field. 302 * the {@code location} field.

mercurial