1 11 package org.eclipse.jdt.internal.eval; 12 13 import org.eclipse.jdt.core.compiler.CharOperation; 14 import org.eclipse.jdt.internal.compiler.codegen.ConstantPool; 15 import org.eclipse.jdt.internal.compiler.lookup.ArrayBinding; 16 import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; 17 import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; 18 import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; 19 import org.eclipse.jdt.internal.compiler.lookup.TypeConstants; 20 21 25 public class CodeSnippetConstantPool extends ConstantPool implements TypeConstants { 26 27 static final char[][] JAVA_LANG_REFLECT_FIELD = new char[][] {JAVA, LANG, REFLECT, "Field".toCharArray()}; static final char[][] JAVA_LANG_REFLECT_ACCESSIBLEOBJECT = new char[][] {JAVA, LANG, REFLECT, "AccessibleObject".toCharArray()}; static final char[][] JAVA_LANG_REFLECT_METHOD = new char[][] {JAVA, LANG, REFLECT, "Method".toCharArray()}; static final char[][] JAVA_LANG_REFLECT_ARRAY = new char[][] {JAVA, LANG, REFLECT, "Array".toCharArray()}; 33 static final char[] GETDECLAREDFIELD_NAME = "getDeclaredField".toCharArray(); static final char[] GETDECLAREDFIELD_SIGNATURE = "(Ljava/lang/String;)Ljava/lang/reflect/Field;".toCharArray(); static final char[] SETACCESSIBLE_NAME = "setAccessible".toCharArray(); static final char[] SETACCESSIBLE_SIGNATURE = "(Z)V".toCharArray(); static final char[] JAVALANGREFLECTFIELD_CONSTANTPOOLNAME = "java/lang/reflect/Field".toCharArray(); static final char[] JAVALANGREFLECTACCESSIBLEOBJECT_CONSTANTPOOLNAME = "java/lang/reflect/AccessibleObject".toCharArray(); static final char[] JAVALANGREFLECTARRAY_CONSTANTPOOLNAME = "java/lang/reflect/Array".toCharArray(); static final char[] JAVALANGREFLECTMETHOD_CONSTANTPOOLNAME = "java/lang/reflect/Method".toCharArray(); static final char[] GET_INT_METHOD_NAME = "getInt".toCharArray(); static final char[] GET_LONG_METHOD_NAME = "getLong".toCharArray(); static final char[] GET_DOUBLE_METHOD_NAME = "getDouble".toCharArray(); static final char[] GET_FLOAT_METHOD_NAME = "getFloat".toCharArray(); static final char[] GET_BYTE_METHOD_NAME = "getByte".toCharArray(); static final char[] GET_CHAR_METHOD_NAME = "getChar".toCharArray(); static final char[] GET_BOOLEAN_METHOD_NAME = "getBoolean".toCharArray(); static final char[] GET_OBJECT_METHOD_NAME = "get".toCharArray(); static final char[] GET_SHORT_METHOD_NAME = "getShort".toCharArray(); static final char[] ARRAY_NEWINSTANCE_NAME = "newInstance".toCharArray(); static final char[] GET_INT_METHOD_SIGNATURE = "(Ljava/lang/Object;)I".toCharArray(); static final char[] GET_LONG_METHOD_SIGNATURE = "(Ljava/lang/Object;)J".toCharArray(); static final char[] GET_DOUBLE_METHOD_SIGNATURE = "(Ljava/lang/Object;)D".toCharArray(); static final char[] GET_FLOAT_METHOD_SIGNATURE = "(Ljava/lang/Object;)F".toCharArray(); static final char[] GET_BYTE_METHOD_SIGNATURE = "(Ljava/lang/Object;)B".toCharArray(); static final char[] GET_CHAR_METHOD_SIGNATURE = "(Ljava/lang/Object;)C".toCharArray(); static final char[] GET_BOOLEAN_METHOD_SIGNATURE = "(Ljava/lang/Object;)Z".toCharArray(); static final char[] GET_OBJECT_METHOD_SIGNATURE = "(Ljava/lang/Object;)Ljava/lang/Object;".toCharArray(); static final char[] GET_SHORT_METHOD_SIGNATURE = "(Ljava/lang/Object;)S".toCharArray(); static final char[] SET_INT_METHOD_NAME = "setInt".toCharArray(); static final char[] SET_LONG_METHOD_NAME = "setLong".toCharArray(); static final char[] SET_DOUBLE_METHOD_NAME = "setDouble".toCharArray(); static final char[] SET_FLOAT_METHOD_NAME = "setFloat".toCharArray(); static final char[] SET_BYTE_METHOD_NAME = "setByte".toCharArray(); static final char[] SET_CHAR_METHOD_NAME = "setChar".toCharArray(); static final char[] SET_BOOLEAN_METHOD_NAME = "setBoolean".toCharArray(); static final char[] SET_OBJECT_METHOD_NAME = "set".toCharArray(); static final char[] SET_SHORT_METHOD_NAME = "setShort".toCharArray(); static final char[] SET_INT_METHOD_SIGNATURE = "(Ljava/lang/Object;I)V".toCharArray(); static final char[] SET_LONG_METHOD_SIGNATURE = "(Ljava/lang/Object;J)V".toCharArray(); static final char[] SET_DOUBLE_METHOD_SIGNATURE = "(Ljava/lang/Object;D)V".toCharArray(); static final char[] SET_FLOAT_METHOD_SIGNATURE = "(Ljava/lang/Object;F)V".toCharArray(); static final char[] SET_BYTE_METHOD_SIGNATURE = "(Ljava/lang/Object;B)V".toCharArray(); static final char[] SET_CHAR_METHOD_SIGNATURE = "(Ljava/lang/Object;C)V".toCharArray(); static final char[] SET_BOOLEAN_METHOD_SIGNATURE = "(Ljava/lang/Object;Z)V".toCharArray(); static final char[] SET_OBJECT_METHOD_SIGNATURE = "(Ljava/lang/Object;Ljava/lang/Object;)V".toCharArray(); static final char[] SET_SHORT_METHOD_SIGNATURE = "(Ljava/lang/Object;S)V".toCharArray(); static final char[] GETDECLAREDMETHOD_NAME = "getDeclaredMethod".toCharArray(); static final char[] GETDECLAREDMETHOD_SIGNATURE = "(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;".toCharArray(); static final char[] ARRAY_NEWINSTANCE_SIGNATURE = "(Ljava/lang/Class;[I)Ljava/lang/Object;".toCharArray(); static final char[] INVOKE_METHOD_METHOD_NAME = "invoke".toCharArray(); static final char[] INVOKE_METHOD_METHOD_SIGNATURE = "(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;".toCharArray(); static final char[] BYTEVALUE_BYTE_METHOD_NAME = "byteValue".toCharArray(); static final char[] BYTEVALUE_BYTE_METHOD_SIGNATURE = "()B".toCharArray(); static final char[] SHORTVALUE_SHORT_METHOD_NAME = "shortValue".toCharArray(); static final char[] DOUBLEVALUE_DOUBLE_METHOD_NAME = "doubleValue".toCharArray(); static final char[] FLOATVALUE_FLOAT_METHOD_NAME = "floatValue".toCharArray(); static final char[] INTVALUE_INTEGER_METHOD_NAME = "intValue".toCharArray(); static final char[] CHARVALUE_CHARACTER_METHOD_NAME = "charValue".toCharArray(); static final char[] BOOLEANVALUE_BOOLEAN_METHOD_NAME = "booleanValue".toCharArray(); static final char[] LONGVALUE_LONG_METHOD_NAME = "longValue".toCharArray(); static final char[] SHORTVALUE_SHORT_METHOD_SIGNATURE = "()S".toCharArray(); static final char[] DOUBLEVALUE_DOUBLE_METHOD_SIGNATURE = "()D".toCharArray(); static final char[] FLOATVALUE_FLOAT_METHOD_SIGNATURE = "()F".toCharArray(); static final char[] INTVALUE_INTEGER_METHOD_SIGNATURE = "()I".toCharArray(); static final char[] CHARVALUE_CHARACTER_METHOD_SIGNATURE = "()C".toCharArray(); static final char[] BOOLEANVALUE_BOOLEAN_METHOD_SIGNATURE = "()Z".toCharArray(); static final char[] LONGVALUE_LONG_METHOD_SIGNATURE = "()J".toCharArray(); static final char[] GETDECLAREDCONSTRUCTOR_NAME = "getDeclaredConstructor".toCharArray(); static final char[] GETDECLAREDCONSTRUCTOR_SIGNATURE = "([Ljava/lang/Class;)Ljava/lang/reflect/Constructor;".toCharArray(); 103 static final int JAVA_LANG_REFLECT_FIELD_TYPE = 0; 105 static final int JAVA_LANG_REFLECT_METHOD_TYPE = 1; 106 static final int JAVA_LANG_REFLECT_ACCESSIBLEOBJECT_TYPE = 2; 107 static final int JAVA_LANG_REFLECT_ARRAY_TYPE = 3; 108 109 static final int GETDECLAREDFIELD_CLASS_METHOD = 0; 111 static final int SETACCESSIBLE_ACCESSIBLEOBJECT_METHOD = 1; 112 static final int GET_INT_METHOD = 2; 113 static final int GET_LONG_METHOD = 3; 114 static final int GET_DOUBLE_METHOD = 4; 115 static final int GET_FLOAT_METHOD = 5; 116 static final int GET_BYTE_METHOD = 6; 117 static final int GET_CHAR_METHOD = 7; 118 static final int GET_BOOLEAN_METHOD = 8; 119 static final int GET_OBJECT_METHOD = 9; 120 static final int GET_SHORT_METHOD = 10; 121 static final int SET_INT_METHOD = 11; 122 static final int SET_LONG_METHOD = 12; 123 static final int SET_DOUBLE_METHOD = 13; 124 static final int SET_FLOAT_METHOD = 14; 125 static final int SET_BYTE_METHOD = 15; 126 static final int SET_CHAR_METHOD = 16; 127 static final int SET_BOOLEAN_METHOD = 17; 128 static final int SET_OBJECT_METHOD = 18; 129 static final int SET_SHORT_METHOD = 19; 130 static final int GETDECLAREDMETHOD_CLASS_METHOD = 20; 131 static final int NEWINSTANCE_ARRAY_METHOD = 21; 132 static final int INVOKE_METHOD_METHOD = 22; 133 static final int BYTEVALUE_BYTE_METHOD = 23; 134 static final int SHORTVALUE_SHORT_METHOD = 24; 135 static final int DOUBLEVALUE_DOUBLE_METHOD = 25; 136 static final int FLOATVALUE_FLOAT_METHOD = 26; 137 static final int INTVALUE_INTEGER_METHOD = 27; 138 static final int CHARVALUE_CHARACTER_METHOD = 28; 139 static final int BOOLEANVALUE_BOOLEAN_METHOD = 29; 140 static final int LONGVALUE_LONG_METHOD = 30; 141 static final int GETDECLAREDCONSTRUCTOR_CLASS_METHOD = 31; 142 143 static final int GETDECLAREDFIELD_CLASS_METHOD_NAME_AND_TYPE = 0; 145 static final int SETACCESSIBLE_ACCESSIBLEOBJECT_METHOD_NAME_AND_TYPE = 1; 146 static final int GET_INT_METHOD_NAME_AND_TYPE = 2; 147 static final int GET_LONG_METHOD_NAME_AND_TYPE = 3; 148 static final int GET_DOUBLE_METHOD_NAME_AND_TYPE = 4; 149 static final int GET_FLOAT_METHOD_NAME_AND_TYPE = 5; 150 static final int GET_BYTE_METHOD_NAME_AND_TYPE = 6; 151 static final int GET_CHAR_METHOD_NAME_AND_TYPE = 7; 152 static final int GET_BOOLEAN_METHOD_NAME_AND_TYPE = 8; 153 static final int GET_OBJECT_METHOD_NAME_AND_TYPE = 9; 154 static final int GET_SHORT_METHOD_NAME_AND_TYPE = 10; 155 static final int SET_INT_METHOD_NAME_AND_TYPE = 11; 156 static final int SET_LONG_METHOD_NAME_AND_TYPE = 12; 157 static final int SET_DOUBLE_METHOD_NAME_AND_TYPE = 13; 158 static final int SET_FLOAT_METHOD_NAME_AND_TYPE = 14; 159 static final int SET_BYTE_METHOD_NAME_AND_TYPE = 15; 160 static final int SET_CHAR_METHOD_NAME_AND_TYPE = 16; 161 static final int SET_BOOLEAN_METHOD_NAME_AND_TYPE = 17; 162 static final int SET_OBJECT_METHOD_NAME_AND_TYPE = 18; 163 static final int SET_SHORT_METHOD_NAME_AND_TYPE = 19; 164 static final int GETDECLAREDMETHOD_CLASS_METHOD_NAME_AND_TYPE = 20; 165 static final int ARRAY_NEWINSTANCE_METHOD_NAME_AND_TYPE = 21; 166 static final int INVOKE_METHOD_METHOD_NAME_AND_TYPE = 22; 167 static final int BYTEVALUE_BYTE_METHOD_NAME_AND_TYPE = 23; 168 static final int SHORTVALUE_SHORT_METHOD_NAME_AND_TYPE = 24; 169 static final int DOUBLEVALUE_DOUBLE_METHOD_NAME_AND_TYPE = 25; 170 static final int FLOATVALUE_FLOAT_METHOD_NAME_AND_TYPE = 26; 171 static final int INTVALUE_INTEGER_METHOD_NAME_AND_TYPE = 27; 172 static final int CHARVALUE_CHARACTER_METHOD_NAME_AND_TYPE = 28; 173 static final int BOOLEANVALUE_BOOLEAN_METHOD_NAME_AND_TYPE = 29; 174 static final int LONGVALUE_LONG_METHOD_NAME_AND_TYPE = 30; 175 static final int GETDECLAREDCONSTRUCTOR_CLASS_METHOD_NAME_AND_TYPE = 31; 176 177 int[] wellKnownTypes = new int[4]; 178 int[] wellKnownMethods = new int[32]; 179 int[] wellKnownMethodNameAndTypes = new int[32]; 180 184 public CodeSnippetConstantPool(org.eclipse.jdt.internal.compiler.ClassFile classFile) { 185 super(classFile); 186 } 187 196 public int indexOfWellKnownMethodNameAndType(MethodBinding methodBinding) { 197 int index = super.indexOfWellKnownMethodNameAndType(methodBinding); 198 if (index == -1) { 199 char firstChar = methodBinding.selector[0]; 200 switch(firstChar) { 201 case 'g': 202 if (methodBinding.parameters.length == 1 203 && methodBinding.parameters[0].id == T_JavaLangString 204 && CharOperation.equals(methodBinding.selector, GETDECLAREDFIELD_NAME) 205 && methodBinding.returnType instanceof ReferenceBinding 206 && CharOperation.equals(((ReferenceBinding) methodBinding.returnType).compoundName,JAVA_LANG_REFLECT_FIELD)) { 207 return GETDECLAREDFIELD_CLASS_METHOD_NAME_AND_TYPE; 208 } 209 if (methodBinding.parameters.length == 2 210 && methodBinding.parameters[0].id == T_JavaLangString 211 && methodBinding.parameters[1].isArrayType() 212 && ((ArrayBinding) methodBinding.parameters[1]).leafComponentType.id == T_JavaLangClass 213 && CharOperation.equals(methodBinding.selector, GETDECLAREDMETHOD_NAME) 214 && methodBinding.returnType instanceof ReferenceBinding 215 && CharOperation.equals(((ReferenceBinding) methodBinding.returnType).compoundName,JAVA_LANG_REFLECT_METHOD)) { 216 return GETDECLAREDMETHOD_CLASS_METHOD_NAME_AND_TYPE; 217 } 218 if (methodBinding.parameters.length == 1 219 && methodBinding.parameters[0].isArrayType() 220 && ((ArrayBinding) methodBinding.parameters[0]).leafComponentType.id == T_JavaLangClass 221 && CharOperation.equals(methodBinding.selector, GETDECLAREDCONSTRUCTOR_NAME) 222 && methodBinding.returnType instanceof ReferenceBinding 223 && CharOperation.equals(((ReferenceBinding) methodBinding.returnType).compoundName,JAVA_LANG_REFLECT_CONSTRUCTOR)) { 224 return GETDECLAREDCONSTRUCTOR_CLASS_METHOD_NAME_AND_TYPE; 225 } 226 if (methodBinding.parameters.length == 1 227 && methodBinding.parameters[0].id == T_Object) { 228 switch(methodBinding.returnType.id) { 229 case T_int : 230 if (CharOperation.equals(methodBinding.selector, GET_INT_METHOD_NAME) 231 && methodBinding.returnType.id == T_int) { 232 return GET_INT_METHOD_NAME_AND_TYPE; 233 } 234 break; 235 case T_byte : 236 if (CharOperation.equals(methodBinding.selector, GET_BYTE_METHOD_NAME) 237 && methodBinding.returnType.id == T_byte) { 238 return GET_BYTE_METHOD_NAME_AND_TYPE; 239 } 240 break; 241 case T_short : 242 if (CharOperation.equals(methodBinding.selector, GET_SHORT_METHOD_NAME) 243 && methodBinding.returnType.id == T_short) { 244 return GET_SHORT_METHOD_NAME_AND_TYPE; 245 } 246 break; 247 case T_char : 248 if (CharOperation.equals(methodBinding.selector, GET_CHAR_METHOD_NAME) 249 && methodBinding.returnType.id == T_char) { 250 return GET_CHAR_METHOD_NAME_AND_TYPE; 251 } 252 break; 253 case T_double : 254 if (CharOperation.equals(methodBinding.selector, GET_DOUBLE_METHOD_NAME) 255 && methodBinding.returnType.id == T_double) { 256 return GET_DOUBLE_METHOD_NAME_AND_TYPE; 257 } 258 break; 259 case T_float : 260 if (CharOperation.equals(methodBinding.selector, GET_FLOAT_METHOD_NAME) 261 && methodBinding.returnType.id == T_float) { 262 return GET_FLOAT_METHOD_NAME_AND_TYPE; 263 } 264 break; 265 case T_long : 266 if (CharOperation.equals(methodBinding.selector, GET_LONG_METHOD_NAME) 267 && methodBinding.returnType.id == T_long) { 268 return GET_LONG_METHOD_NAME_AND_TYPE; 269 } 270 break; 271 case T_boolean : 272 if (CharOperation.equals(methodBinding.selector, GET_BOOLEAN_METHOD_NAME) 273 && methodBinding.returnType.id == T_boolean) { 274 return GET_BOOLEAN_METHOD_NAME_AND_TYPE; 275 } 276 break; 277 case T_Object : 278 if (CharOperation.equals(methodBinding.selector, GET_OBJECT_METHOD_NAME) 279 && methodBinding.returnType.id == T_JavaLangObject) { 280 return GET_OBJECT_METHOD_NAME_AND_TYPE; 281 } 282 } 283 } 284 break; 285 case 'i': 286 if (methodBinding.parameters.length == 0 287 && CharOperation.equals(methodBinding.selector, INTVALUE_INTEGER_METHOD_NAME) 288 && methodBinding.returnType.id == T_int) { 289 return INTVALUE_INTEGER_METHOD_NAME_AND_TYPE; 290 } 291 if (methodBinding.parameters.length == 2 292 && methodBinding.parameters[0].id == T_JavaLangObject 293 && methodBinding.parameters[1].isArrayType() 294 && ((ArrayBinding) methodBinding.parameters[1]).leafComponentType.id == T_JavaLangObject 295 && CharOperation.equals(methodBinding.selector, INVOKE_METHOD_METHOD_NAME) 296 && methodBinding.returnType.id == T_JavaLangObject) { 297 return INVOKE_METHOD_METHOD_NAME_AND_TYPE; 298 } 299 break; 300 case 's': 301 if (methodBinding.parameters.length == 0 302 && CharOperation.equals(methodBinding.selector, SHORTVALUE_SHORT_METHOD_NAME) 303 && methodBinding.returnType.id == T_short) { 304 return SHORTVALUE_SHORT_METHOD_NAME_AND_TYPE; 305 } 306 if (methodBinding.parameters.length == 1 307 && methodBinding.parameters[0].id == T_boolean 308 && methodBinding.selector.length == 13 309 && CharOperation.equals(methodBinding.selector, SETACCESSIBLE_NAME) 310 && methodBinding.returnType.id == T_void) { 311 return SETACCESSIBLE_ACCESSIBLEOBJECT_METHOD_NAME_AND_TYPE; 312 } 313 if (methodBinding.returnType.id == T_void 314 && methodBinding.parameters.length == 2 315 && methodBinding.parameters[0].id == T_Object) { 316 switch(methodBinding.returnType.id) { 317 case T_int : 318 if (methodBinding.parameters[1].id == T_int && CharOperation.equals(methodBinding.selector, SET_INT_METHOD_NAME) 319 && methodBinding.returnType.id == T_void) { 320 return SET_INT_METHOD_NAME_AND_TYPE; 321 } 322 break; 323 case T_byte : 324 if (methodBinding.parameters[1].id == T_byte && CharOperation.equals(methodBinding.selector, SET_BYTE_METHOD_NAME) 325 && methodBinding.returnType.id == T_void) { 326 return SET_BYTE_METHOD_NAME_AND_TYPE; 327 } 328 break; 329 case T_short : 330 if (methodBinding.parameters[1].id == T_short && CharOperation.equals(methodBinding.selector, SET_SHORT_METHOD_NAME) 331 && methodBinding.returnType.id == T_void) { 332 return SET_SHORT_METHOD_NAME_AND_TYPE; 333 } 334 break; 335 case T_char : 336 if (methodBinding.parameters[1].id == T_char && CharOperation.equals(methodBinding.selector, SET_CHAR_METHOD_NAME) 337 && methodBinding.returnType.id == T_void) { 338 return SET_CHAR_METHOD_NAME_AND_TYPE; 339 } 340 break; 341 case T_double : 342 if (methodBinding.parameters[1].id == T_double && CharOperation.equals(methodBinding.selector, SET_DOUBLE_METHOD_NAME) 343 && methodBinding.returnType.id == T_void) { 344 return SET_DOUBLE_METHOD_NAME_AND_TYPE; 345 } 346 break; 347 case T_float : 348 if (methodBinding.parameters[1].id == T_float && CharOperation.equals(methodBinding.selector, SET_FLOAT_METHOD_NAME) 349 && methodBinding.returnType.id == T_void) { 350 return SET_FLOAT_METHOD_NAME_AND_TYPE; 351 } 352 break; 353 case T_long : 354 if (methodBinding.parameters[1].id == T_long && CharOperation.equals(methodBinding.selector, SET_LONG_METHOD_NAME) 355 && methodBinding.returnType.id == T_void) { 356 return SET_LONG_METHOD_NAME_AND_TYPE; 357 } 358 break; 359 case T_boolean : 360 if (methodBinding.parameters[1].id == T_boolean && CharOperation.equals(methodBinding.selector, SET_BOOLEAN_METHOD_NAME) 361 && methodBinding.returnType.id == T_void) { 362 return SET_BOOLEAN_METHOD_NAME_AND_TYPE; 363 } 364 break; 365 case T_Object : 366 if (methodBinding.parameters[1].id == T_Object && CharOperation.equals(methodBinding.selector, SET_OBJECT_METHOD_NAME) 367 && methodBinding.returnType.id == T_void) { 368 return SET_OBJECT_METHOD_NAME_AND_TYPE; 369 } 370 } 371 } 372 break; 373 case 'f': 374 if (methodBinding.parameters.length == 0 375 && CharOperation.equals(methodBinding.selector, FLOATVALUE_FLOAT_METHOD_NAME) 376 && methodBinding.returnType.id == T_float) { 377 return FLOATVALUE_FLOAT_METHOD_NAME_AND_TYPE; 378 } 379 break; 380 case 'd': 381 if (methodBinding.parameters.length == 0 382 && CharOperation.equals(methodBinding.selector, DOUBLEVALUE_DOUBLE_METHOD_NAME) 383 && methodBinding.returnType.id == T_double) { 384 return DOUBLEVALUE_DOUBLE_METHOD_NAME_AND_TYPE; 385 } 386 break; 387 case 'c': 388 if (methodBinding.parameters.length == 0 389 && CharOperation.equals(methodBinding.selector, CHARVALUE_CHARACTER_METHOD_NAME) 390 && methodBinding.returnType.id == T_char) { 391 return CHARVALUE_CHARACTER_METHOD_NAME_AND_TYPE; 392 } 393 break; 394 case 'b': 395 if (methodBinding.parameters.length == 0 396 && CharOperation.equals(methodBinding.selector, BOOLEANVALUE_BOOLEAN_METHOD_NAME) 397 && methodBinding.returnType.id == T_boolean) { 398 return BOOLEANVALUE_BOOLEAN_METHOD_NAME_AND_TYPE; 399 } 400 if (methodBinding.parameters.length == 0 401 && CharOperation.equals(methodBinding.selector, BYTEVALUE_BYTE_METHOD_NAME) 402 && methodBinding.returnType.id == T_byte) { 403 return BYTEVALUE_BYTE_METHOD_NAME_AND_TYPE; 404 } 405 break; 406 case 'l': 407 if (methodBinding.parameters.length == 0 408 && CharOperation.equals(methodBinding.selector, LONGVALUE_LONG_METHOD_NAME) 409 && methodBinding.returnType.id == T_long) { 410 return LONGVALUE_LONG_METHOD_NAME_AND_TYPE; 411 } 412 break; 413 case 'n': 414 if (methodBinding.parameters.length == 2 415 && methodBinding.parameters[0].id == T_JavaLangClass 416 && methodBinding.parameters[1].isArrayType() 417 && ((ArrayBinding) methodBinding.parameters[1]).leafComponentType.id == T_int 418 && CharOperation.equals(methodBinding.selector, ARRAY_NEWINSTANCE_NAME) 419 && methodBinding.returnType instanceof ReferenceBinding 420 && CharOperation.equals(((ReferenceBinding) methodBinding.returnType).compoundName,JAVA_LANG_REFLECT_ARRAY)) { 421 return ARRAY_NEWINSTANCE_METHOD_NAME_AND_TYPE; 422 } 423 } 424 425 } 426 return index; 427 } 428 437 public int indexOfWellKnownMethods(MethodBinding methodBinding) { 438 int index = super.indexOfWellKnownMethods(methodBinding); 439 if (index == -1) { 440 char firstChar = methodBinding.selector[0]; 441 switch(firstChar) { 442 case 'g': 443 if (methodBinding.declaringClass.id == T_JavaLangClass 444 && methodBinding.parameters.length == 1 445 && methodBinding.parameters[0].id == T_JavaLangString 446 && CharOperation.equals(methodBinding.selector, GETDECLAREDFIELD_NAME)) { 447 return GETDECLAREDFIELD_CLASS_METHOD; 448 } 449 if (methodBinding.declaringClass.id == T_JavaLangClass 450 && methodBinding.parameters.length == 2 451 && methodBinding.parameters[0].id == T_JavaLangString 452 && methodBinding.parameters[1].isArrayType() 453 && ((ArrayBinding) methodBinding.parameters[1]).leafComponentType.id == T_JavaLangClass 454 && CharOperation.equals(methodBinding.selector, GETDECLAREDMETHOD_NAME)) { 455 return GETDECLAREDMETHOD_CLASS_METHOD; 456 } 457 if (methodBinding.declaringClass.id == T_JavaLangClass 458 && methodBinding.parameters.length == 1 459 && methodBinding.parameters[0].isArrayType() 460 && ((ArrayBinding) methodBinding.parameters[0]).leafComponentType.id == T_JavaLangClass 461 && CharOperation.equals(methodBinding.selector, GETDECLAREDCONSTRUCTOR_NAME)) { 462 return GETDECLAREDCONSTRUCTOR_CLASS_METHOD; 463 } 464 if (CharOperation.equals(methodBinding.declaringClass.compoundName, JAVA_LANG_REFLECT_FIELD) 465 && methodBinding.parameters.length == 1 466 && methodBinding.parameters[0].id == T_Object) { 467 switch(methodBinding.returnType.id) { 468 case T_int : 469 if (CharOperation.equals(methodBinding.selector, GET_INT_METHOD_NAME)) { 470 return GET_INT_METHOD; 471 } 472 break; 473 case T_byte : 474 if (CharOperation.equals(methodBinding.selector, GET_BYTE_METHOD_NAME)) { 475 return GET_BYTE_METHOD; 476 } 477 break; 478 case T_short : 479 if (CharOperation.equals(methodBinding.selector, GET_SHORT_METHOD_NAME)) { 480 return GET_SHORT_METHOD; 481 } 482 break; 483 case T_char : 484 if (CharOperation.equals(methodBinding.selector, GET_CHAR_METHOD_NAME)) { 485 return GET_CHAR_METHOD; 486 } 487 break; 488 case T_double : 489 if (CharOperation.equals(methodBinding.selector, GET_DOUBLE_METHOD_NAME)) { 490 return GET_DOUBLE_METHOD; 491 } 492 break; 493 case T_float : 494 if (CharOperation.equals(methodBinding.selector, GET_FLOAT_METHOD_NAME)) { 495 return GET_FLOAT_METHOD; 496 } 497 break; 498 case T_long : 499 if (CharOperation.equals(methodBinding.selector, GET_LONG_METHOD_NAME)) { 500 return GET_LONG_METHOD; 501 } 502 break; 503 case T_boolean : 504 if (CharOperation.equals(methodBinding.selector, GET_BOOLEAN_METHOD_NAME)) { 505 return GET_BOOLEAN_METHOD; 506 } 507 break; 508 case T_Object : 509 if (CharOperation.equals(methodBinding.selector, GET_OBJECT_METHOD_NAME)) { 510 return GET_OBJECT_METHOD; 511 } 512 } 513 } 514 break; 515 case 'i': 516 if (methodBinding.declaringClass.id == T_JavaLangInteger 517 && methodBinding.parameters.length == 0 518 && CharOperation.equals(methodBinding.selector, INTVALUE_INTEGER_METHOD_NAME)) { 519 return INTVALUE_INTEGER_METHOD; 520 } 521 if (CharOperation.equals(methodBinding.declaringClass.compoundName, JAVA_LANG_REFLECT_METHOD) 522 && methodBinding.parameters.length == 2 523 && methodBinding.parameters[0].id == T_JavaLangObject 524 && methodBinding.parameters[1].isArrayType() 525 && ((ArrayBinding) methodBinding.parameters[1]).leafComponentType.id == T_JavaLangObject 526 && CharOperation.equals(methodBinding.selector, INVOKE_METHOD_METHOD_NAME)) { 527 return INVOKE_METHOD_METHOD; 528 } 529 break; 530 case 'b': 531 if (methodBinding.declaringClass.id == T_JavaLangByte 532 && methodBinding.parameters.length == 0 533 && CharOperation.equals(methodBinding.selector, BYTEVALUE_BYTE_METHOD_NAME)) { 534 return BYTEVALUE_BYTE_METHOD; 535 } 536 if (methodBinding.declaringClass.id == T_JavaLangBoolean 537 && methodBinding.parameters.length == 0 538 && CharOperation.equals(methodBinding.selector, BOOLEANVALUE_BOOLEAN_METHOD_NAME)) { 539 return BOOLEANVALUE_BOOLEAN_METHOD; 540 } 541 break; 542 case 's': 543 if (methodBinding.declaringClass.id == T_JavaLangShort 544 && methodBinding.parameters.length == 0 545 && CharOperation.equals(methodBinding.selector, SHORTVALUE_SHORT_METHOD_NAME)) { 546 return SHORTVALUE_SHORT_METHOD; 547 } 548 if (CharOperation.equals(methodBinding.declaringClass.compoundName, JAVA_LANG_REFLECT_ACCESSIBLEOBJECT) 549 && methodBinding.parameters.length == 1 550 && methodBinding.parameters[0].id == T_boolean 551 && methodBinding.selector.length == 13 552 && CharOperation.equals(methodBinding.selector, SETACCESSIBLE_NAME)) { 553 return SETACCESSIBLE_ACCESSIBLEOBJECT_METHOD; 554 } 555 if (CharOperation.equals(methodBinding.declaringClass.compoundName, JAVA_LANG_REFLECT_FIELD) 556 && methodBinding.returnType.id == T_void 557 && methodBinding.parameters.length == 2 558 && methodBinding.parameters[0].id == T_Object) { 559 switch(methodBinding.returnType.id) { 560 case T_int : 561 if (methodBinding.parameters[1].id == T_int && CharOperation.equals(methodBinding.selector, SET_INT_METHOD_NAME)) { 562 return SET_INT_METHOD; 563 } 564 break; 565 case T_byte : 566 if (methodBinding.parameters[1].id == T_byte && CharOperation.equals(methodBinding.selector, SET_BYTE_METHOD_NAME)) { 567 return SET_BYTE_METHOD; 568 } 569 break; 570 case T_short : 571 if (methodBinding.parameters[1].id == T_short && CharOperation.equals(methodBinding.selector, SET_SHORT_METHOD_NAME)) { 572 return SET_SHORT_METHOD; 573 } 574 break; 575 case T_char : 576 if (methodBinding.parameters[1].id == T_char && CharOperation.equals(methodBinding.selector, SET_CHAR_METHOD_NAME)) { 577 return SET_CHAR_METHOD; 578 } 579 break; 580 case T_double : 581 if (methodBinding.parameters[1].id == T_double && CharOperation.equals(methodBinding.selector, SET_DOUBLE_METHOD_NAME)) { 582 return SET_DOUBLE_METHOD; 583 } 584 break; 585 case T_float : 586 if (methodBinding.parameters[1].id == T_float && CharOperation.equals(methodBinding.selector, SET_FLOAT_METHOD_NAME)) { 587 return SET_FLOAT_METHOD; 588 } 589 break; 590 case T_long : 591 if (methodBinding.parameters[1].id == T_long && CharOperation.equals(methodBinding.selector, SET_LONG_METHOD_NAME)) { 592 return SET_LONG_METHOD; 593 } 594 break; 595 case T_boolean : 596 if (methodBinding.parameters[1].id == T_boolean && CharOperation.equals(methodBinding.selector, SET_BOOLEAN_METHOD_NAME)) { 597 return SET_BOOLEAN_METHOD; 598 } 599 break; 600 case T_Object : 601 if (methodBinding.parameters[1].id == T_Object && CharOperation.equals(methodBinding.selector, SET_OBJECT_METHOD_NAME)) { 602 return SET_OBJECT_METHOD; 603 } 604 } 605 } 606 break; 607 case 'f': 608 if (methodBinding.declaringClass.id == T_JavaLangFloat 609 && methodBinding.parameters.length == 0 610 && CharOperation.equals(methodBinding.selector, FLOATVALUE_FLOAT_METHOD_NAME)) { 611 return FLOATVALUE_FLOAT_METHOD; 612 } 613 break; 614 case 'd': 615 if (methodBinding.declaringClass.id == T_JavaLangDouble 616 && methodBinding.parameters.length == 0 617 && CharOperation.equals(methodBinding.selector, DOUBLEVALUE_DOUBLE_METHOD_NAME)) { 618 return DOUBLEVALUE_DOUBLE_METHOD; 619 } 620 break; 621 case 'c': 622 if (methodBinding.declaringClass.id == T_JavaLangCharacter 623 && methodBinding.parameters.length == 0 624 && CharOperation.equals(methodBinding.selector, CHARVALUE_CHARACTER_METHOD_NAME)) { 625 return CHARVALUE_CHARACTER_METHOD; 626 } 627 break; 628 case 'l': 629 if (methodBinding.declaringClass.id == T_JavaLangLong 630 && methodBinding.parameters.length == 0 631 && CharOperation.equals(methodBinding.selector, LONGVALUE_LONG_METHOD_NAME)) { 632 return LONGVALUE_LONG_METHOD; 633 } 634 break; 635 case 'n': 636 if (CharOperation.equals(methodBinding.declaringClass.compoundName, JAVA_LANG_REFLECT_ARRAY) 637 && methodBinding.parameters.length == 2 638 && methodBinding.parameters[0].id == T_JavaLangClass 639 && methodBinding.parameters[1].isArrayType() 640 && ((ArrayBinding) methodBinding.parameters[1]).leafComponentType.id == T_int 641 && CharOperation.equals(methodBinding.selector, ARRAY_NEWINSTANCE_NAME)) { 642 return NEWINSTANCE_ARRAY_METHOD; 643 } 644 break; 645 } 646 } 647 return index; 648 } 649 658 public int indexOfWellKnownTypes(TypeBinding typeBinding) { 659 int index = super.indexOfWellKnownTypes(typeBinding); 660 if (index == -1) { 661 if (!typeBinding.isBaseType() && !typeBinding.isArrayType()) { 662 ReferenceBinding type = (ReferenceBinding) typeBinding; 663 if (type.compoundName.length == 4) { 664 if (CharOperation.equals(JAVA_LANG_REFLECT_FIELD, type.compoundName)) { 665 return JAVA_LANG_REFLECT_FIELD_TYPE; 666 } 667 if (CharOperation.equals(JAVA_LANG_REFLECT_METHOD, type.compoundName)) { 668 return JAVA_LANG_REFLECT_METHOD_TYPE; 669 } 670 if (CharOperation.equals(JAVA_LANG_REFLECT_ARRAY, type.compoundName)) { 671 return JAVA_LANG_REFLECT_ARRAY_TYPE; 672 } 673 if (CharOperation.equals(JAVA_LANG_REFLECT_ACCESSIBLEOBJECT, type.compoundName)) { 674 return JAVA_LANG_REFLECT_ACCESSIBLEOBJECT_TYPE; 675 } 676 } 677 } 678 } 679 return index; 680 } 681 689 public int literalIndex(MethodBinding aMethodBinding) { 690 int index; 691 int nameAndTypeIndex; 692 int classIndex; 693 int indexWellKnownMethod; 694 if ((indexWellKnownMethod = super.indexOfWellKnownMethods(aMethodBinding)) == -1) { 695 if ((indexWellKnownMethod = indexOfWellKnownMethods(aMethodBinding)) == -1) { 696 if (aMethodBinding.declaringClass.isInterface()) { 697 if ((index = this.interfaceMethodCache.get(aMethodBinding)) < 0) { 699 classIndex = literalIndex(aMethodBinding.declaringClass); 700 nameAndTypeIndex = 701 literalIndexForMethods( 702 literalIndex(aMethodBinding.constantPoolName()), 703 literalIndex(aMethodBinding.signature()), 704 aMethodBinding); 705 index = this.interfaceMethodCache.put(aMethodBinding, this.currentIndex++); 706 writeU1(InterfaceMethodRefTag); 709 writeU2(classIndex); 711 writeU2(nameAndTypeIndex); 713 } 714 } else { 715 if ((index = this.methodCache.get(aMethodBinding)) < 0) { 717 classIndex = literalIndex(aMethodBinding.declaringClass); 718 nameAndTypeIndex = 719 literalIndexForMethods( 720 literalIndex(aMethodBinding.constantPoolName()), 721 literalIndex(aMethodBinding.signature()), 722 aMethodBinding); 723 index = this.methodCache.put(aMethodBinding, this.currentIndex++); 724 writeU1(MethodRefTag); 727 writeU2(classIndex); 729 writeU2(nameAndTypeIndex); 731 } 732 } 733 } else { 734 if ((index = this.wellKnownMethods[indexWellKnownMethod]) == 0) { 736 if (aMethodBinding.declaringClass.isInterface()) { 738 classIndex = literalIndex(aMethodBinding.declaringClass); 740 nameAndTypeIndex = 741 literalIndexForMethods( 742 literalIndex(aMethodBinding.constantPoolName()), 743 literalIndex(aMethodBinding.signature()), 744 aMethodBinding); 745 index = this.wellKnownMethods[indexWellKnownMethod] = this.currentIndex++; 746 writeU1(InterfaceMethodRefTag); 749 writeU2(classIndex); 751 writeU2(nameAndTypeIndex); 753 } else { 754 classIndex = literalIndex(aMethodBinding.declaringClass); 756 nameAndTypeIndex = 757 literalIndexForMethods( 758 literalIndex(aMethodBinding.constantPoolName()), 759 literalIndex(aMethodBinding.signature()), 760 aMethodBinding); 761 index = this.wellKnownMethods[indexWellKnownMethod] = this.currentIndex++; 762 writeU1(MethodRefTag); 765 writeU2(classIndex); 767 writeU2(nameAndTypeIndex); 769 } 770 } 771 } 772 } else { 773 index = super.literalIndex(aMethodBinding); 774 } 775 return index; 776 } 777 783 public int literalIndex(TypeBinding aTypeBinding) { 784 int index; 785 int nameIndex; 786 int indexWellKnownType; 787 if ((indexWellKnownType = super.indexOfWellKnownTypes(aTypeBinding)) == -1) { 788 if ((indexWellKnownType = indexOfWellKnownTypes(aTypeBinding)) == -1) { 789 if ((index = this.classCache.get(aTypeBinding)) < 0) { 790 nameIndex = literalIndex(aTypeBinding.constantPoolName()); 792 index = this.classCache.put(aTypeBinding, this.currentIndex++); 793 writeU1(ClassTag); 794 writeU2(nameIndex); 796 } 797 } else { 798 if ((index = this.wellKnownTypes[indexWellKnownType]) == 0) { 799 nameIndex = literalIndex(aTypeBinding.constantPoolName()); 801 index = this.wellKnownTypes[indexWellKnownType] = this.currentIndex++; 802 writeU1(ClassTag); 803 writeU2(nameIndex); 805 } 806 } 807 } else { 808 index = super.literalIndex(aTypeBinding); 809 } 810 return index; 811 } 812 819 public int literalIndexForJavaLangBooleanBooleanValue() { 820 int index; 821 int nameAndTypeIndex; 822 int classIndex; 823 if ((index = this.wellKnownMethods[BOOLEANVALUE_BOOLEAN_METHOD]) == 0) { 825 classIndex = literalIndexForJavaLangBoolean(); 826 if ((nameAndTypeIndex = this.wellKnownMethodNameAndTypes[BOOLEANVALUE_BOOLEAN_METHOD_NAME_AND_TYPE]) == 0) { 827 int nameIndex = literalIndex(BOOLEANVALUE_BOOLEAN_METHOD_NAME); 828 int typeIndex = literalIndex(BOOLEANVALUE_BOOLEAN_METHOD_SIGNATURE); 829 nameAndTypeIndex = this.wellKnownMethodNameAndTypes[BOOLEANVALUE_BOOLEAN_METHOD_NAME_AND_TYPE] = this.currentIndex++; 830 writeU1(NameAndTypeTag); 831 writeU2(nameIndex); 832 writeU2(typeIndex); 833 } 834 index = this.wellKnownMethods[BOOLEANVALUE_BOOLEAN_METHOD_NAME_AND_TYPE] = this.currentIndex++; 835 writeU1(MethodRefTag); 838 writeU2(classIndex); 840 writeU2(nameAndTypeIndex); 842 } 843 return index; 844 } 845 852 public int literalIndexForJavaLangByteByteValue() { 853 int index; 854 int nameAndTypeIndex; 855 int classIndex; 856 if ((index = this.wellKnownMethods[BYTEVALUE_BYTE_METHOD]) == 0) { 858 classIndex = literalIndexForJavaLangByte(); 859 if ((nameAndTypeIndex = this.wellKnownMethodNameAndTypes[BYTEVALUE_BYTE_METHOD_NAME_AND_TYPE]) == 0) { 860 int nameIndex = literalIndex(BYTEVALUE_BYTE_METHOD_NAME); 861 int typeIndex = literalIndex(BYTEVALUE_BYTE_METHOD_SIGNATURE); 862 nameAndTypeIndex = this.wellKnownMethodNameAndTypes[BYTEVALUE_BYTE_METHOD_NAME_AND_TYPE] = this.currentIndex++; 863 writeU1(NameAndTypeTag); 864 writeU2(nameIndex); 865 writeU2(typeIndex); 866 } 867 index = this.wellKnownMethods[BYTEVALUE_BYTE_METHOD] = this.currentIndex++; 868 writeU1(MethodRefTag); 871 writeU2(classIndex); 873 writeU2(nameAndTypeIndex); 875 } 876 return index; 877 } 878 885 public int literalIndexForJavaLangCharacterCharValue() { 886 int index; 887 int nameAndTypeIndex; 888 int classIndex; 889 if ((index = this.wellKnownMethods[CHARVALUE_CHARACTER_METHOD]) == 0) { 891 classIndex = literalIndexForJavaLangCharacter(); 892 if ((nameAndTypeIndex = this.wellKnownMethodNameAndTypes[CHARVALUE_CHARACTER_METHOD_NAME_AND_TYPE]) == 0) { 893 int nameIndex = literalIndex(CHARVALUE_CHARACTER_METHOD_NAME); 894 int typeIndex = literalIndex(CHARVALUE_CHARACTER_METHOD_SIGNATURE); 895 nameAndTypeIndex = this.wellKnownMethodNameAndTypes[CHARVALUE_CHARACTER_METHOD_NAME_AND_TYPE] = this.currentIndex++; 896 writeU1(NameAndTypeTag); 897 writeU2(nameIndex); 898 writeU2(typeIndex); 899 } 900 index = this.wellKnownMethods[CHARVALUE_CHARACTER_METHOD] = this.currentIndex++; 901 writeU1(MethodRefTag); 904 writeU2(classIndex); 906 writeU2(nameAndTypeIndex); 908 } 909 return index; 910 } 911 918 public int literalIndexForJavaLangClassGetDeclaredConstructor() { 919 int index; 920 int nameAndTypeIndex; 921 int classIndex; 922 if ((index = this.wellKnownMethods[GETDECLAREDCONSTRUCTOR_CLASS_METHOD]) == 0) { 924 classIndex = literalIndexForJavaLangClass(); 925 if ((nameAndTypeIndex = this.wellKnownMethodNameAndTypes[GETDECLAREDCONSTRUCTOR_CLASS_METHOD_NAME_AND_TYPE]) == 0) { 926 int nameIndex = literalIndex(GETDECLAREDCONSTRUCTOR_NAME); 927 int typeIndex = literalIndex(GETDECLAREDCONSTRUCTOR_SIGNATURE); 928 nameAndTypeIndex = this.wellKnownMethodNameAndTypes[GETDECLAREDCONSTRUCTOR_CLASS_METHOD_NAME_AND_TYPE] = this.currentIndex++; 929 writeU1(NameAndTypeTag); 930 writeU2(nameIndex); 931 writeU2(typeIndex); 932 } 933 index = this.wellKnownMethods[GETDECLAREDCONSTRUCTOR_CLASS_METHOD] = this.currentIndex++; 934 writeU1(MethodRefTag); 937 writeU2(classIndex); 939 writeU2(nameAndTypeIndex); 941 } 942 return index; 943 } 944 951 public int literalIndexForJavaLangClassGetDeclaredField() { 952 int index; 953 int nameAndTypeIndex; 954 int classIndex; 955 if ((index = this.wellKnownMethods[GETDECLAREDFIELD_CLASS_METHOD]) == 0) { 957 classIndex = literalIndexForJavaLangClass(); 958 if ((nameAndTypeIndex = this.wellKnownMethodNameAndTypes[GETDECLAREDFIELD_CLASS_METHOD_NAME_AND_TYPE]) == 0) { 959 int nameIndex = literalIndex(GETDECLAREDFIELD_NAME); 960 int typeIndex = literalIndex(GETDECLAREDFIELD_SIGNATURE); 961 nameAndTypeIndex = this.wellKnownMethodNameAndTypes[GETDECLAREDFIELD_CLASS_METHOD_NAME_AND_TYPE] = this.currentIndex++; 962 writeU1(NameAndTypeTag); 963 writeU2(nameIndex); 964 writeU2(typeIndex); 965 } 966 index = this.wellKnownMethods[GETDECLAREDFIELD_CLASS_METHOD] = this.currentIndex++; 967 writeU1(MethodRefTag); 970 writeU2(classIndex); 972 writeU2(nameAndTypeIndex); 974 } 975 return index; 976 } 977 984 public int literalIndexForJavaLangClassGetDeclaredMethod() { 985 int index; 986 int nameAndTypeIndex; 987 int classIndex; 988 if ((index = this.wellKnownMethods[GETDECLAREDMETHOD_CLASS_METHOD]) == 0) { 990 classIndex = literalIndexForJavaLangClass(); 991 if ((nameAndTypeIndex = this.wellKnownMethodNameAndTypes[GETDECLAREDMETHOD_CLASS_METHOD_NAME_AND_TYPE]) == 0) { 992 int nameIndex = literalIndex(GETDECLAREDMETHOD_NAME); 993 int typeIndex = literalIndex(GETDECLAREDMETHOD_SIGNATURE); 994 nameAndTypeIndex = this.wellKnownMethodNameAndTypes[GETDECLAREDMETHOD_CLASS_METHOD_NAME_AND_TYPE] = this.currentIndex++; 995 writeU1(NameAndTypeTag); 996 writeU2(nameIndex); 997 writeU2(typeIndex); 998 } 999 index = this.wellKnownMethods[GETDECLAREDMETHOD_CLASS_METHOD] = this.currentIndex++; 1000 writeU1(MethodRefTag); 1003 writeU2(classIndex); 1005 writeU2(nameAndTypeIndex); 1007 } 1008 return index; 1009} 1010 1017public int literalIndexForJavaLangDoubleDoubleValue() { 1018 int index; 1019 int nameAndTypeIndex; 1020 int classIndex; 1021 if ((index = this.wellKnownMethods[DOUBLEVALUE_DOUBLE_METHOD]) == 0) { 1023 classIndex = literalIndexForJavaLangDouble(); 1024 if ((nameAndTypeIndex = this.wellKnownMethodNameAndTypes[DOUBLEVALUE_DOUBLE_METHOD_NAME_AND_TYPE]) == 0) { 1025 int nameIndex = literalIndex(DOUBLEVALUE_DOUBLE_METHOD_NAME); 1026 int typeIndex = literalIndex(DOUBLEVALUE_DOUBLE_METHOD_SIGNATURE); 1027 nameAndTypeIndex = this.wellKnownMethodNameAndTypes[DOUBLEVALUE_DOUBLE_METHOD_NAME_AND_TYPE] = this.currentIndex++; 1028 writeU1(NameAndTypeTag); 1029 writeU2(nameIndex); 1030 writeU2(typeIndex); 1031 } 1032 index = this.wellKnownMethods[DOUBLEVALUE_DOUBLE_METHOD] = this.currentIndex++; 1033 writeU1(MethodRefTag); 1036 writeU2(classIndex); 1038 writeU2(nameAndTypeIndex); 1040 } 1041 return index; 1042} 1043 1050public int literalIndexForJavaLangFloatFloatValue() { 1051 int index; 1052 int nameAndTypeIndex; 1053 int classIndex; 1054 if ((index = this.wellKnownMethods[FLOATVALUE_FLOAT_METHOD]) == 0) { 1056 classIndex = literalIndexForJavaLangFloat(); 1057 if ((nameAndTypeIndex = this.wellKnownMethodNameAndTypes[FLOATVALUE_FLOAT_METHOD_NAME_AND_TYPE]) == 0) { 1058 int nameIndex = literalIndex(FLOATVALUE_FLOAT_METHOD_NAME); 1059 int typeIndex = literalIndex(FLOATVALUE_FLOAT_METHOD_SIGNATURE); 1060 nameAndTypeIndex = this.wellKnownMethodNameAndTypes[FLOATVALUE_FLOAT_METHOD_NAME_AND_TYPE] = this.currentIndex++; 1061 writeU1(NameAndTypeTag); 1062 writeU2(nameIndex); 1063 writeU2(typeIndex); 1064 } 1065 index = this.wellKnownMethods[FLOATVALUE_FLOAT_METHOD] = this.currentIndex++; 1066 writeU1(MethodRefTag); 1069 writeU2(classIndex); 1071 writeU2(nameAndTypeIndex); 1073 } 1074 return index; 1075} 1076 1083public int literalIndexForJavaLangIntegerIntValue() { 1084 int index; 1085 int nameAndTypeIndex; 1086 int classIndex; 1087 if ((index = this.wellKnownMethods[INTVALUE_INTEGER_METHOD]) == 0) { 1089 classIndex = literalIndexForJavaLangInteger(); 1090 if ((nameAndTypeIndex = this.wellKnownMethodNameAndTypes[INTVALUE_INTEGER_METHOD_NAME_AND_TYPE]) == 0) { 1091 int nameIndex = literalIndex(INTVALUE_INTEGER_METHOD_NAME); 1092 int typeIndex = literalIndex(INTVALUE_INTEGER_METHOD_SIGNATURE); 1093 nameAndTypeIndex = this.wellKnownMethodNameAndTypes[INTVALUE_INTEGER_METHOD_NAME_AND_TYPE] = this.currentIndex++; 1094 writeU1(NameAndTypeTag); 1095 writeU2(nameIndex); 1096 writeU2(typeIndex); 1097 } 1098 index = this.wellKnownMethods[INTVALUE_INTEGER_METHOD] = this.currentIndex++; 1099 writeU1(MethodRefTag); 1102 writeU2(classIndex); 1104 writeU2(nameAndTypeIndex); 1106 } 1107 return index; 1108} 1109 1116public int literalIndexForJavaLangLongLongValue() { 1117 int index; 1118 int nameAndTypeIndex; 1119 int classIndex; 1120 if ((index = this.wellKnownMethods[LONGVALUE_LONG_METHOD]) == 0) { 1122 classIndex = literalIndexForJavaLangLong(); 1123 if ((nameAndTypeIndex = this.wellKnownMethodNameAndTypes[LONGVALUE_LONG_METHOD_NAME_AND_TYPE]) == 0) { 1124 int nameIndex = literalIndex(LONGVALUE_LONG_METHOD_NAME); 1125 int typeIndex = literalIndex(LONGVALUE_LONG_METHOD_SIGNATURE); 1126 nameAndTypeIndex = this.wellKnownMethodNameAndTypes[LONGVALUE_LONG_METHOD_NAME_AND_TYPE] = this.currentIndex++; 1127 writeU1(NameAndTypeTag); 1128 writeU2(nameIndex); 1129 writeU2(typeIndex); 1130 } 1131 index = this.wellKnownMethods[LONGVALUE_LONG_METHOD] = this.currentIndex++; 1132 writeU1(MethodRefTag); 1135 writeU2(classIndex); 1137 writeU2(nameAndTypeIndex); 1139 } 1140 return index; 1141} 1142 1149public int literalIndexForJavaLangReflectAccessibleObject() { 1150 int index; 1151 if ((index = this.wellKnownTypes[JAVA_LANG_REFLECT_ACCESSIBLEOBJECT_TYPE]) == 0) { 1152 int nameIndex; 1153 nameIndex = literalIndex(JAVALANGREFLECTACCESSIBLEOBJECT_CONSTANTPOOLNAME); 1155 index = this.wellKnownTypes[JAVA_LANG_REFLECT_ACCESSIBLEOBJECT_TYPE] = this.currentIndex++; 1156 writeU1(ClassTag); 1157 writeU2(nameIndex); 1159 } 1160 return index; 1161} 1162 1169public int literalIndexForJavaLangReflectAccessibleObjectSetAccessible() { 1170 int index; 1171 int nameAndTypeIndex; 1172 int classIndex; 1173 if ((index = this.wellKnownMethods[SETACCESSIBLE_ACCESSIBLEOBJECT_METHOD]) == 0) { 1175 classIndex = literalIndexForJavaLangReflectAccessibleObject(); 1176 if ((nameAndTypeIndex = this.wellKnownMethodNameAndTypes[SETACCESSIBLE_ACCESSIBLEOBJECT_METHOD_NAME_AND_TYPE]) == 0) { 1177 int nameIndex = literalIndex(SETACCESSIBLE_NAME); 1178 int typeIndex = literalIndex(SETACCESSIBLE_SIGNATURE); 1179 nameAndTypeIndex = this.wellKnownMethodNameAndTypes[SETACCESSIBLE_ACCESSIBLEOBJECT_METHOD_NAME_AND_TYPE] = this.currentIndex++; 1180 writeU1(NameAndTypeTag); 1181 writeU2(nameIndex); 1182 writeU2(typeIndex); 1183 } 1184 index = this.wellKnownMethods[SETACCESSIBLE_ACCESSIBLEOBJECT_METHOD] = this.currentIndex++; 1185 writeU1(MethodRefTag); 1188 writeU2(classIndex); 1190 writeU2(nameAndTypeIndex); 1192 } 1193 return index; 1194} 1195 1202public int literalIndexForJavaLangReflectArray() { 1203 int index; 1204 if ((index = this.wellKnownTypes[JAVA_LANG_REFLECT_ARRAY_TYPE]) == 0) { 1205 int nameIndex; 1206 nameIndex = literalIndex(JAVALANGREFLECTARRAY_CONSTANTPOOLNAME); 1208 index = this.wellKnownTypes[JAVA_LANG_REFLECT_ARRAY_TYPE] = this.currentIndex++; 1209 writeU1(ClassTag); 1210 writeU2(nameIndex); 1212 } 1213 return index; 1214} 1215 1222public int literalIndexForJavaLangReflectArrayNewInstance() { 1223 int index; 1224 int nameAndTypeIndex; 1225 int classIndex; 1226 if ((index = this.wellKnownMethods[NEWINSTANCE_ARRAY_METHOD]) == 0) { 1228 classIndex = literalIndexForJavaLangReflectArray(); 1229 if ((nameAndTypeIndex = this.wellKnownMethodNameAndTypes[ARRAY_NEWINSTANCE_METHOD_NAME_AND_TYPE]) == 0) { 1230 int nameIndex = literalIndex(ARRAY_NEWINSTANCE_NAME); 1231 int typeIndex = literalIndex(ARRAY_NEWINSTANCE_SIGNATURE); 1232 nameAndTypeIndex = this.wellKnownMethodNameAndTypes[ARRAY_NEWINSTANCE_METHOD_NAME_AND_TYPE] = this.currentIndex++; 1233 writeU1(NameAndTypeTag); 1234 writeU2(nameIndex); 1235 writeU2(typeIndex); 1236 } 1237 index = this.wellKnownMethods[NEWINSTANCE_ARRAY_METHOD] = this.currentIndex++; 1238 writeU1(MethodRefTag); 1241 writeU2(classIndex); 1243 writeU2(nameAndTypeIndex); 1245 } 1246 return index; 1247} 1248 1255public int literalIndexForJavaLangReflectField() { 1256 int index; 1257 if ((index = this.wellKnownTypes[JAVA_LANG_REFLECT_FIELD_TYPE]) == 0) { 1258 int nameIndex; 1259 nameIndex = literalIndex(JAVALANGREFLECTFIELD_CONSTANTPOOLNAME); 1261 index = this.wellKnownTypes[JAVA_LANG_REFLECT_FIELD_TYPE] = this.currentIndex++; 1262 writeU1(ClassTag); 1263 writeU2(nameIndex); 1265 } 1266 return index; 1267} 1268 1275public int literalIndexForJavaLangReflectMethod() { 1276 int index; 1277 if ((index = this.wellKnownTypes[JAVA_LANG_REFLECT_METHOD_TYPE]) == 0) { 1278 int nameIndex; 1279 nameIndex = literalIndex(JAVALANGREFLECTMETHOD_CONSTANTPOOLNAME); 1281 index = this.wellKnownTypes[JAVA_LANG_REFLECT_METHOD_TYPE] = this.currentIndex++; 1282 writeU1(ClassTag); 1283 writeU2(nameIndex); 1285 } 1286 return index; 1287} 1288 1295public int literalIndexForJavaLangReflectMethodInvoke() { 1296 int index; 1297 int nameAndTypeIndex; 1298 int classIndex; 1299 if ((index = this.wellKnownMethods[INVOKE_METHOD_METHOD]) == 0) { 1301 classIndex = literalIndexForJavaLangReflectMethod(); 1302 if ((nameAndTypeIndex = this.wellKnownMethodNameAndTypes[INVOKE_METHOD_METHOD_NAME_AND_TYPE]) == 0) { 1303 int nameIndex = literalIndex(INVOKE_METHOD_METHOD_NAME); 1304 int typeIndex = literalIndex(INVOKE_METHOD_METHOD_SIGNATURE); 1305 nameAndTypeIndex = this.wellKnownMethodNameAndTypes[INVOKE_METHOD_METHOD_NAME_AND_TYPE] = this.currentIndex++; 1306 writeU1(NameAndTypeTag); 1307 writeU2(nameIndex); 1308 writeU2(typeIndex); 1309 } 1310 index = this.wellKnownMethods[INVOKE_METHOD_METHOD] = this.currentIndex++; 1311 writeU1(MethodRefTag); 1314 writeU2(classIndex); 1316 writeU2(nameAndTypeIndex); 1318 } 1319 return index; 1320} 1321 1328public int literalIndexForJavaLangShortShortValue() { 1329 int index; 1330 int nameAndTypeIndex; 1331 int classIndex; 1332 if ((index = this.wellKnownMethods[SHORTVALUE_SHORT_METHOD]) == 0) { 1334 classIndex = literalIndexForJavaLangShort(); 1335 if ((nameAndTypeIndex = this.wellKnownMethodNameAndTypes[SHORTVALUE_SHORT_METHOD_NAME_AND_TYPE]) == 0) { 1336 int nameIndex = literalIndex(SHORTVALUE_SHORT_METHOD_NAME); 1337 int typeIndex = literalIndex(SHORTVALUE_SHORT_METHOD_SIGNATURE); 1338 nameAndTypeIndex = this.wellKnownMethodNameAndTypes[SHORTVALUE_SHORT_METHOD_NAME_AND_TYPE] = this.currentIndex++; 1339 writeU1(NameAndTypeTag); 1340 writeU2(nameIndex); 1341 writeU2(typeIndex); 1342 } 1343 index = this.wellKnownMethods[SHORTVALUE_SHORT_METHOD] = this.currentIndex++; 1344 writeU1(MethodRefTag); 1347 writeU2(classIndex); 1349 writeU2(nameAndTypeIndex); 1351 } 1352 return index; 1353} 1354 1363public int literalIndexForMethods(int nameIndex, int typeIndex, MethodBinding key) { 1364 int index; 1365 int indexOfWellKnownMethodNameAndType; 1366 if ((indexOfWellKnownMethodNameAndType = super.indexOfWellKnownMethodNameAndType(key)) == -1) { 1367 if ((indexOfWellKnownMethodNameAndType = indexOfWellKnownMethodNameAndType(key)) == -1) { 1368 if ((index = this.nameAndTypeCacheForMethods.get(key)) == -1) { 1370 index = this.nameAndTypeCacheForMethods.put(key, this.currentIndex++); 1372 writeU1(NameAndTypeTag); 1373 writeU2(nameIndex); 1374 writeU2(typeIndex); 1375 } 1376 } else { 1377 if ((index = this.wellKnownMethodNameAndTypes[indexOfWellKnownMethodNameAndType]) == 0) { 1378 index = this.wellKnownMethodNameAndTypes[indexOfWellKnownMethodNameAndType] = this.currentIndex++; 1379 writeU1(NameAndTypeTag); 1380 writeU2(nameIndex); 1381 writeU2(typeIndex); 1382 } 1383 } 1384 } else { 1385 index = super.literalIndexForMethods(nameIndex,typeIndex,key); 1386 } 1387 return index; 1388} 1389 1396public int literalIndexJavaLangReflectFieldGetter(int typeID) { 1397 int index = 0; 1398 int nameAndTypeIndex = 0; 1399 int classIndex = 0; 1400 switch (typeID) { 1401 case T_int : 1402 if ((index = this.wellKnownMethods[GET_INT_METHOD]) == 0) { 1403 classIndex = literalIndexForJavaLangReflectField(); 1404 if ((nameAndTypeIndex = 1405 this.wellKnownMethodNameAndTypes[GET_INT_METHOD_NAME_AND_TYPE]) 1406 == 0) { 1407 int nameIndex = literalIndex(GET_INT_METHOD_NAME); 1408 int typeIndex = literalIndex(GET_INT_METHOD_SIGNATURE); 1409 nameAndTypeIndex = 1410 this.wellKnownMethodNameAndTypes[GET_INT_METHOD_NAME_AND_TYPE] = this.currentIndex++; 1411 writeU1(NameAndTypeTag); 1412 writeU2(nameIndex); 1413 writeU2(typeIndex); 1414 } 1415 index = this.wellKnownMethods[GET_INT_METHOD] = this.currentIndex++; 1416 writeU1(MethodRefTag); 1419 writeU2(classIndex); 1421 writeU2(nameAndTypeIndex); 1423 } 1424 break; 1425 case T_byte : 1426 if ((index = this.wellKnownMethods[GET_BYTE_METHOD]) == 0) { 1427 classIndex = literalIndexForJavaLangReflectField(); 1428 if ((nameAndTypeIndex = 1429 this.wellKnownMethodNameAndTypes[GET_BYTE_METHOD_NAME_AND_TYPE]) 1430 == 0) { 1431 int nameIndex = literalIndex(GET_BYTE_METHOD_NAME); 1432 int typeIndex = literalIndex(GET_BYTE_METHOD_SIGNATURE); 1433 nameAndTypeIndex = 1434 this.wellKnownMethodNameAndTypes[GET_BYTE_METHOD_NAME_AND_TYPE] = this.currentIndex++; 1435 writeU1(NameAndTypeTag); 1436 writeU2(nameIndex); 1437 writeU2(typeIndex); 1438 } 1439 index = this.wellKnownMethods[GET_BYTE_METHOD] = this.currentIndex++; 1440 writeU1(MethodRefTag); 1443 writeU2(classIndex); 1445 writeU2(nameAndTypeIndex); 1447 } 1448 break; 1449 case T_short : 1450 if ((index = this.wellKnownMethods[GET_SHORT_METHOD]) == 0) { 1451 classIndex = literalIndexForJavaLangReflectField(); 1452 if ((nameAndTypeIndex = 1453 this.wellKnownMethodNameAndTypes[GET_SHORT_METHOD_NAME_AND_TYPE]) 1454 == 0) { 1455 int nameIndex = literalIndex(GET_SHORT_METHOD_NAME); 1456 int typeIndex = literalIndex(GET_SHORT_METHOD_SIGNATURE); 1457 nameAndTypeIndex = 1458 this.wellKnownMethodNameAndTypes[GET_SHORT_METHOD_NAME_AND_TYPE] = this.currentIndex++; 1459 writeU1(NameAndTypeTag); 1460 writeU2(nameIndex); 1461 writeU2(typeIndex); 1462 } 1463 index = this.wellKnownMethods[GET_SHORT_METHOD] = this.currentIndex++; 1464 writeU1(MethodRefTag); 1467 writeU2(classIndex); 1469 writeU2(nameAndTypeIndex); 1471 } 1472 break; 1473 case T_long : 1474 if ((index = this.wellKnownMethods[GET_LONG_METHOD]) == 0) { 1475 classIndex = literalIndexForJavaLangReflectField(); 1476 if ((nameAndTypeIndex = 1477 this.wellKnownMethodNameAndTypes[GET_LONG_METHOD_NAME_AND_TYPE]) 1478 == 0) { 1479 int nameIndex = literalIndex(GET_LONG_METHOD_NAME); 1480 int typeIndex = literalIndex(GET_LONG_METHOD_SIGNATURE); 1481 nameAndTypeIndex = 1482 this.wellKnownMethodNameAndTypes[GET_LONG_METHOD_NAME_AND_TYPE] = this.currentIndex++; 1483 writeU1(NameAndTypeTag); 1484 writeU2(nameIndex); 1485 writeU2(typeIndex); 1486 } 1487 index = this.wellKnownMethods[GET_LONG_METHOD] = this.currentIndex++; 1488 writeU1(MethodRefTag); 1491 writeU2(classIndex); 1493 writeU2(nameAndTypeIndex); 1495 } 1496 break; 1497 case T_float : 1498 if ((index = this.wellKnownMethods[GET_FLOAT_METHOD]) == 0) { 1499 classIndex = literalIndexForJavaLangReflectField(); 1500 if ((nameAndTypeIndex = 1501 this.wellKnownMethodNameAndTypes[GET_FLOAT_METHOD_NAME_AND_TYPE]) 1502 == 0) { 1503 int nameIndex = literalIndex(GET_FLOAT_METHOD_NAME); 1504 int typeIndex = literalIndex(GET_FLOAT_METHOD_SIGNATURE); 1505 nameAndTypeIndex = 1506 this.wellKnownMethodNameAndTypes[GET_FLOAT_METHOD_NAME_AND_TYPE] = this.currentIndex++; 1507 writeU1(NameAndTypeTag); 1508 writeU2(nameIndex); 1509 writeU2(typeIndex); 1510 } 1511 index = this.wellKnownMethods[GET_FLOAT_METHOD] = this.currentIndex++; 1512 writeU1(MethodRefTag); 1515 writeU2(classIndex); 1517 writeU2(nameAndTypeIndex); 1519 } 1520 break; 1521 case T_double : 1522 if ((index = this.wellKnownMethods[GET_DOUBLE_METHOD]) == 0) { 1523 classIndex = literalIndexForJavaLangReflectField(); 1524 if ((nameAndTypeIndex = 1525 this.wellKnownMethodNameAndTypes[GET_DOUBLE_METHOD_NAME_AND_TYPE]) 1526 == 0) { 1527 int nameIndex = literalIndex(GET_DOUBLE_METHOD_NAME); 1528 int typeIndex = literalIndex(GET_DOUBLE_METHOD_SIGNATURE); 1529 nameAndTypeIndex = 1530 this.wellKnownMethodNameAndTypes[GET_DOUBLE_METHOD_NAME_AND_TYPE] = 1531 this.currentIndex++; 1532 writeU1(NameAndTypeTag); 1533 writeU2(nameIndex); 1534 writeU2(typeIndex); 1535 } 1536 index = this.wellKnownMethods[GET_DOUBLE_METHOD] = this.currentIndex++; 1537 writeU1(MethodRefTag); 1540 writeU2(classIndex); 1542 writeU2(nameAndTypeIndex); 1544 } 1545 break; 1546 case T_char : 1547 if ((index = this.wellKnownMethods[GET_CHAR_METHOD]) == 0) { 1548 classIndex = literalIndexForJavaLangReflectField(); 1549 if ((nameAndTypeIndex = 1550 this.wellKnownMethodNameAndTypes[GET_CHAR_METHOD_NAME_AND_TYPE]) 1551 == 0) { 1552 int nameIndex = literalIndex(GET_CHAR_METHOD_NAME); 1553 int typeIndex = literalIndex(GET_CHAR_METHOD_SIGNATURE); 1554 nameAndTypeIndex = 1555 this.wellKnownMethodNameAndTypes[GET_CHAR_METHOD_NAME_AND_TYPE] = this.currentIndex++; 1556 writeU1(NameAndTypeTag); 1557 writeU2(nameIndex); 1558 writeU2(typeIndex); 1559 } 1560 index = this.wellKnownMethods[GET_CHAR_METHOD] = this.currentIndex++; 1561 writeU1(MethodRefTag); 1564 writeU2(classIndex); 1566 writeU2(nameAndTypeIndex); 1568 } 1569 break; 1570 case T_boolean : 1571 if ((index = this.wellKnownMethods[GET_BOOLEAN_METHOD]) == 0) { 1572 classIndex = literalIndexForJavaLangReflectField(); 1573 if ((nameAndTypeIndex = 1574 this.wellKnownMethodNameAndTypes[GET_BOOLEAN_METHOD_NAME_AND_TYPE]) 1575 == 0) { 1576 int nameIndex = literalIndex(GET_BOOLEAN_METHOD_NAME); 1577 int typeIndex = literalIndex(GET_BOOLEAN_METHOD_SIGNATURE); 1578 nameAndTypeIndex = 1579 this.wellKnownMethodNameAndTypes[GET_BOOLEAN_METHOD_NAME_AND_TYPE] = 1580 this.currentIndex++; 1581 writeU1(NameAndTypeTag); 1582 writeU2(nameIndex); 1583 writeU2(typeIndex); 1584 } 1585 index = this.wellKnownMethods[GET_BOOLEAN_METHOD] = this.currentIndex++; 1586 writeU1(MethodRefTag); 1589 writeU2(classIndex); 1591 writeU2(nameAndTypeIndex); 1593 } 1594 break; 1595 default : 1596 if ((index = this.wellKnownMethods[GET_OBJECT_METHOD]) == 0) { 1597 classIndex = literalIndexForJavaLangReflectField(); 1598 if ((nameAndTypeIndex = 1599 this.wellKnownMethodNameAndTypes[GET_OBJECT_METHOD_NAME_AND_TYPE]) 1600 == 0) { 1601 int nameIndex = literalIndex(GET_OBJECT_METHOD_NAME); 1602 int typeIndex = literalIndex(GET_OBJECT_METHOD_SIGNATURE); 1603 nameAndTypeIndex = 1604 this.wellKnownMethodNameAndTypes[GET_OBJECT_METHOD_NAME_AND_TYPE] = 1605 this.currentIndex++; 1606 writeU1(NameAndTypeTag); 1607 writeU2(nameIndex); 1608 writeU2(typeIndex); 1609 } 1610 index = this.wellKnownMethods[GET_OBJECT_METHOD] = this.currentIndex++; 1611 writeU1(MethodRefTag); 1614 writeU2(classIndex); 1616 writeU2(nameAndTypeIndex); 1618 } 1619 } 1620 return index; 1621} 1622 1629public int literalIndexJavaLangReflectFieldSetter(int typeID) { 1630 int index = 0; 1631 int nameAndTypeIndex = 0; 1632 int classIndex = 0; 1633 switch (typeID) { 1634 case T_int : 1635 if ((index = this.wellKnownMethods[SET_INT_METHOD]) == 0) { 1636 classIndex = literalIndexForJavaLangReflectField(); 1637 if ((nameAndTypeIndex = 1638 this.wellKnownMethodNameAndTypes[SET_INT_METHOD_NAME_AND_TYPE]) 1639 == 0) { 1640 int nameIndex = literalIndex(SET_INT_METHOD_NAME); 1641 int typeIndex = literalIndex(SET_INT_METHOD_SIGNATURE); 1642 nameAndTypeIndex = 1643 this.wellKnownMethodNameAndTypes[SET_INT_METHOD_NAME_AND_TYPE] = this.currentIndex++; 1644 writeU1(NameAndTypeTag); 1645 writeU2(nameIndex); 1646 writeU2(typeIndex); 1647 } 1648 index = this.wellKnownMethods[SET_INT_METHOD] = this.currentIndex++; 1649 writeU1(MethodRefTag); 1652 writeU2(classIndex); 1654 writeU2(nameAndTypeIndex); 1656 } 1657 break; 1658 case T_byte : 1659 if ((index = this.wellKnownMethods[SET_BYTE_METHOD]) == 0) { 1660 classIndex = literalIndexForJavaLangReflectField(); 1661 if ((nameAndTypeIndex = 1662 this.wellKnownMethodNameAndTypes[SET_BYTE_METHOD_NAME_AND_TYPE]) 1663 == 0) { 1664 int nameIndex = literalIndex(SET_BYTE_METHOD_NAME); 1665 int typeIndex = literalIndex(SET_BYTE_METHOD_SIGNATURE); 1666 nameAndTypeIndex = 1667 this.wellKnownMethodNameAndTypes[SET_BYTE_METHOD_NAME_AND_TYPE] = this.currentIndex++; 1668 writeU1(NameAndTypeTag); 1669 writeU2(nameIndex); 1670 writeU2(typeIndex); 1671 } 1672 index = this.wellKnownMethods[SET_BYTE_METHOD] = this.currentIndex++; 1673 writeU1(MethodRefTag); 1676 writeU2(classIndex); 1678 writeU2(nameAndTypeIndex); 1680 } 1681 break; 1682 case T_short : 1683 if ((index = this.wellKnownMethods[SET_SHORT_METHOD]) == 0) { 1684 classIndex = literalIndexForJavaLangReflectField(); 1685 if ((nameAndTypeIndex = 1686 this.wellKnownMethodNameAndTypes[SET_SHORT_METHOD_NAME_AND_TYPE]) 1687 == 0) { 1688 int nameIndex = literalIndex(SET_SHORT_METHOD_NAME); 1689 int typeIndex = literalIndex(SET_SHORT_METHOD_SIGNATURE); 1690 nameAndTypeIndex = 1691 this.wellKnownMethodNameAndTypes[SET_SHORT_METHOD_NAME_AND_TYPE] = this.currentIndex++; 1692 writeU1(NameAndTypeTag); 1693 writeU2(nameIndex); 1694 writeU2(typeIndex); 1695 } 1696 index = this.wellKnownMethods[SET_SHORT_METHOD] = this.currentIndex++; 1697 writeU1(MethodRefTag); 1700 writeU2(classIndex); 1702 writeU2(nameAndTypeIndex); 1704 } 1705 break; 1706 case T_long : 1707 if ((index = this.wellKnownMethods[SET_LONG_METHOD]) == 0) { 1708 classIndex = literalIndexForJavaLangReflectField(); 1709 if ((nameAndTypeIndex = 1710 this.wellKnownMethodNameAndTypes[SET_LONG_METHOD_NAME_AND_TYPE]) 1711 == 0) { 1712 int nameIndex = literalIndex(SET_LONG_METHOD_NAME); 1713 int typeIndex = literalIndex(SET_LONG_METHOD_SIGNATURE); 1714 nameAndTypeIndex = 1715 this.wellKnownMethodNameAndTypes[SET_LONG_METHOD_NAME_AND_TYPE] = this.currentIndex++; 1716 writeU1(NameAndTypeTag); 1717 writeU2(nameIndex); 1718 writeU2(typeIndex); 1719 } 1720 index = this.wellKnownMethods[SET_LONG_METHOD] = this.currentIndex++; 1721 writeU1(MethodRefTag); 1724 writeU2(classIndex); 1726 writeU2(nameAndTypeIndex); 1728 } 1729 break; 1730 case T_float : 1731 if ((index = this.wellKnownMethods[SET_FLOAT_METHOD]) == 0) { 1732 classIndex = literalIndexForJavaLangReflectField(); 1733 if ((nameAndTypeIndex = 1734 this.wellKnownMethodNameAndTypes[SET_FLOAT_METHOD_NAME_AND_TYPE]) 1735 == 0) { 1736 int nameIndex = literalIndex(SET_FLOAT_METHOD_NAME); 1737 int typeIndex = literalIndex(SET_FLOAT_METHOD_SIGNATURE); 1738 nameAndTypeIndex = 1739 this.wellKnownMethodNameAndTypes[SET_FLOAT_METHOD_NAME_AND_TYPE] = this.currentIndex++; 1740 writeU1(NameAndTypeTag); 1741 writeU2(nameIndex); 1742 writeU2(typeIndex); 1743 } 1744 index = this.wellKnownMethods[SET_FLOAT_METHOD] = this.currentIndex++; 1745 writeU1(MethodRefTag); 1748 writeU2(classIndex); 1750 writeU2(nameAndTypeIndex); 1752 } 1753 break; 1754 case T_double : 1755 if ((index = this.wellKnownMethods[SET_DOUBLE_METHOD]) == 0) { 1756 classIndex = literalIndexForJavaLangReflectField(); 1757 if ((nameAndTypeIndex = 1758 this.wellKnownMethodNameAndTypes[SET_DOUBLE_METHOD_NAME_AND_TYPE]) 1759 == 0) { 1760 int nameIndex = literalIndex(SET_DOUBLE_METHOD_NAME); 1761 int typeIndex = literalIndex(SET_DOUBLE_METHOD_SIGNATURE); 1762 nameAndTypeIndex = 1763 this.wellKnownMethodNameAndTypes[SET_DOUBLE_METHOD_NAME_AND_TYPE] = 1764 this.currentIndex++; 1765 writeU1(NameAndTypeTag); 1766 writeU2(nameIndex); 1767 writeU2(typeIndex); 1768 } 1769 index = this.wellKnownMethods[SET_DOUBLE_METHOD] = this.currentIndex++; 1770 writeU1(MethodRefTag); 1773 writeU2(classIndex); 1775 writeU2(nameAndTypeIndex); 1777 } 1778 break; 1779 case T_char : 1780 if ((index = this.wellKnownMethods[SET_CHAR_METHOD]) == 0) { 1781 classIndex = literalIndexForJavaLangReflectField(); 1782 if ((nameAndTypeIndex = 1783 this.wellKnownMethodNameAndTypes[SET_CHAR_METHOD_NAME_AND_TYPE]) 1784 == 0) { 1785 int nameIndex = literalIndex(SET_CHAR_METHOD_NAME); 1786 int typeIndex = literalIndex(SET_CHAR_METHOD_SIGNATURE); 1787 nameAndTypeIndex = 1788 this.wellKnownMethodNameAndTypes[SET_CHAR_METHOD_NAME_AND_TYPE] = this.currentIndex++; 1789 writeU1(NameAndTypeTag); 1790 writeU2(nameIndex); 1791 writeU2(typeIndex); 1792 } 1793 index = this.wellKnownMethods[SET_CHAR_METHOD] = this.currentIndex++; 1794 writeU1(MethodRefTag); 1797 writeU2(classIndex); 1799 writeU2(nameAndTypeIndex); 1801 } 1802 break; 1803 case T_boolean : 1804 if ((index = this.wellKnownMethods[SET_BOOLEAN_METHOD]) == 0) { 1805 classIndex = literalIndexForJavaLangReflectField(); 1806 if ((nameAndTypeIndex = 1807 this.wellKnownMethodNameAndTypes[SET_BOOLEAN_METHOD_NAME_AND_TYPE]) 1808 == 0) { 1809 int nameIndex = literalIndex(SET_BOOLEAN_METHOD_NAME); 1810 int typeIndex = literalIndex(SET_BOOLEAN_METHOD_SIGNATURE); 1811 nameAndTypeIndex = 1812 this.wellKnownMethodNameAndTypes[SET_BOOLEAN_METHOD_NAME_AND_TYPE] = 1813 this.currentIndex++; 1814 writeU1(NameAndTypeTag); 1815 writeU2(nameIndex); 1816 writeU2(typeIndex); 1817 } 1818 index = this.wellKnownMethods[SET_BOOLEAN_METHOD] = this.currentIndex++; 1819 writeU1(MethodRefTag); 1822 writeU2(classIndex); 1824 writeU2(nameAndTypeIndex); 1826 } 1827 break; 1828 default : 1829 if ((index = this.wellKnownMethods[SET_OBJECT_METHOD]) == 0) { 1830 classIndex = literalIndexForJavaLangReflectField(); 1831 if ((nameAndTypeIndex = 1832 this.wellKnownMethodNameAndTypes[SET_OBJECT_METHOD_NAME_AND_TYPE]) 1833 == 0) { 1834 int nameIndex = literalIndex(SET_OBJECT_METHOD_NAME); 1835 int typeIndex = literalIndex(SET_OBJECT_METHOD_SIGNATURE); 1836 nameAndTypeIndex = 1837 this.wellKnownMethodNameAndTypes[SET_OBJECT_METHOD_NAME_AND_TYPE] = 1838 this.currentIndex++; 1839 writeU1(NameAndTypeTag); 1840 writeU2(nameIndex); 1841 writeU2(typeIndex); 1842 } 1843 index = this.wellKnownMethods[SET_OBJECT_METHOD] = this.currentIndex++; 1844 writeU1(MethodRefTag); 1847 writeU2(classIndex); 1849 writeU2(nameAndTypeIndex); 1851 } 1852 } 1853 return index; 1854} 1855} 1856 | Popular Tags |