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

changeset 1571
af8417e590f4
parent 1563
bc456436c613
child 1755
ddb4a2bfcd82
equal deleted inserted replaced
1570:f91144b7da75 1571:af8417e590f4
124 public List<TypePathEntry> location = List.nil(); 124 public List<TypePathEntry> location = List.nil();
125 125
126 // Tree position. 126 // Tree position.
127 public int pos = -1; 127 public int pos = -1;
128 128
129 // For typecasts, type tests, new (and locals, as start_pc). 129 // For type casts, type tests, new, locals (as start_pc),
130 // and method and constructor reference type arguments.
130 public boolean isValidOffset = false; 131 public boolean isValidOffset = false;
131 public int offset = -1; 132 public int offset = -1;
132 133
133 // For locals. arrays same length 134 // For locals. arrays same length
134 public int[] lvarOffset = null; 135 public int[] lvarOffset = null;
154 StringBuilder sb = new StringBuilder(); 155 StringBuilder sb = new StringBuilder();
155 sb.append('['); 156 sb.append('[');
156 sb.append(type); 157 sb.append(type);
157 158
158 switch (type) { 159 switch (type) {
159 // type cast
160 case CAST:
161 // instanceof 160 // instanceof
162 case INSTANCEOF: 161 case INSTANCEOF:
163 // new expression 162 // new expression
164 case NEW: 163 case NEW:
164 // constructor/method reference receiver
165 case CONSTRUCTOR_REFERENCE:
166 case METHOD_REFERENCE:
165 sb.append(", offset = "); 167 sb.append(", offset = ");
166 sb.append(offset); 168 sb.append(offset);
167 break; 169 break;
168 // local variable 170 // local variable
169 case LOCAL_VARIABLE: 171 case LOCAL_VARIABLE:
221 // method parameter 223 // method parameter
222 case METHOD_FORMAL_PARAMETER: 224 case METHOD_FORMAL_PARAMETER:
223 sb.append(", param_index = "); 225 sb.append(", param_index = ");
224 sb.append(parameter_index); 226 sb.append(parameter_index);
225 break; 227 break;
228 // type cast
229 case CAST:
226 // method/constructor/reference type argument 230 // method/constructor/reference type argument
227 case CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT: 231 case CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT:
228 case METHOD_INVOCATION_TYPE_ARGUMENT: 232 case METHOD_INVOCATION_TYPE_ARGUMENT:
233 case CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT:
229 case METHOD_REFERENCE_TYPE_ARGUMENT: 234 case METHOD_REFERENCE_TYPE_ARGUMENT:
230 sb.append(", offset = "); 235 sb.append(", offset = ");
231 sb.append(offset); 236 sb.append(offset);
232 sb.append(", type_index = "); 237 sb.append(", type_index = ");
233 sb.append(type_index); 238 sb.append(type_index);
234 break; 239 break;
235 // We don't need to worry about these 240 // We don't need to worry about these
236 case METHOD_RETURN: 241 case METHOD_RETURN:
237 case FIELD: 242 case FIELD:
238 break;
239 // lambda formal parameter
240 case LAMBDA_FORMAL_PARAMETER:
241 // TODO: also needs an offset?
242 sb.append(", param_index = ");
243 sb.append(parameter_index);
244 break; 243 break;
245 case UNKNOWN: 244 case UNKNOWN:
246 sb.append(", position UNKNOWN!"); 245 sb.append(", position UNKNOWN!");
247 break; 246 break;
248 default: 247 default:

mercurial