src/share/classes/com/sun/tools/javap/AnnotationWriter.java

changeset 1563
bc456436c613
parent 1521
71f35e4b93a5
child 2525
2eb010b6cb22
equal deleted inserted replaced
1562:2154ed9ff6c8 1563:bc456436c613
89 89
90 public void write(TypeAnnotation.Position pos, boolean showOffsets) { 90 public void write(TypeAnnotation.Position pos, boolean showOffsets) {
91 print(pos.type); 91 print(pos.type);
92 92
93 switch (pos.type) { 93 switch (pos.type) {
94 // type cast
95 case CAST:
96 // instanceof 94 // instanceof
97 case INSTANCEOF: 95 case INSTANCEOF:
98 // new expression 96 // new expression
99 case NEW: 97 case NEW:
98 // constructor/method reference receiver
99 case CONSTRUCTOR_REFERENCE:
100 case METHOD_REFERENCE:
100 if (showOffsets) { 101 if (showOffsets) {
101 print(", offset="); 102 print(", offset=");
102 print(pos.offset); 103 print(pos.offset);
103 } 104 }
104 break; 105 break;
160 // method parameter 161 // method parameter
161 case METHOD_FORMAL_PARAMETER: 162 case METHOD_FORMAL_PARAMETER:
162 print(", param_index="); 163 print(", param_index=");
163 print(pos.parameter_index); 164 print(pos.parameter_index);
164 break; 165 break;
166 // type cast
167 case CAST:
165 // method/constructor/reference type argument 168 // method/constructor/reference type argument
166 case CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT: 169 case CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT:
167 case METHOD_INVOCATION_TYPE_ARGUMENT: 170 case METHOD_INVOCATION_TYPE_ARGUMENT:
171 case CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT:
168 case METHOD_REFERENCE_TYPE_ARGUMENT: 172 case METHOD_REFERENCE_TYPE_ARGUMENT:
169 if (showOffsets) { 173 if (showOffsets) {
170 print(", offset="); 174 print(", offset=");
171 print(pos.offset); 175 print(pos.offset);
172 } 176 }
174 print(pos.type_index); 178 print(pos.type_index);
175 break; 179 break;
176 // We don't need to worry about these 180 // We don't need to worry about these
177 case METHOD_RETURN: 181 case METHOD_RETURN:
178 case FIELD: 182 case FIELD:
179 break;
180 // lambda formal parameter
181 case LAMBDA_FORMAL_PARAMETER:
182 print(", param_index=");
183 print(pos.parameter_index);
184 break; 183 break;
185 case UNKNOWN: 184 case UNKNOWN:
186 throw new AssertionError("AnnotationWriter: UNKNOWN target type should never occur!"); 185 throw new AssertionError("AnnotationWriter: UNKNOWN target type should never occur!");
187 default: 186 default:
188 throw new AssertionError("AnnotationWriter: Unknown target type for position: " + pos); 187 throw new AssertionError("AnnotationWriter: Unknown target type for position: " + pos);

mercurial