Reads a numeric or string constant pool entry in #b. This method is intended for Attribute sub classes, and is normally not needed by class generators or adapters. @param constantPoolEntryIndex the index of a CONSTANT_Integer, CONSTANT_Float, CONSTANT_Long, CONSTANT_Doubl
(final int constantPoolEntryIndex, final char[] charBuffer)
| 3532 | * constant pool entry. |
| 3533 | */ |
| 3534 | public Object readConst(final int constantPoolEntryIndex, final char[] charBuffer) { |
| 3535 | int cpInfoOffset = cpInfoOffsets[constantPoolEntryIndex]; |
| 3536 | switch (b[cpInfoOffset - 1]) { |
| 3537 | case Symbol.CONSTANT_INTEGER_TAG: |
| 3538 | return readInt(cpInfoOffset); |
| 3539 | case Symbol.CONSTANT_FLOAT_TAG: |
| 3540 | return Float.intBitsToFloat(readInt(cpInfoOffset)); |
| 3541 | case Symbol.CONSTANT_LONG_TAG: |
| 3542 | return readLong(cpInfoOffset); |
| 3543 | case Symbol.CONSTANT_DOUBLE_TAG: |
| 3544 | return Double.longBitsToDouble(readLong(cpInfoOffset)); |
| 3545 | case Symbol.CONSTANT_CLASS_TAG: |
| 3546 | return Type.getObjectType(readUTF8(cpInfoOffset, charBuffer)); |
| 3547 | case Symbol.CONSTANT_STRING_TAG: |
| 3548 | return readUTF8(cpInfoOffset, charBuffer); |
| 3549 | case Symbol.CONSTANT_METHOD_TYPE_TAG: |
| 3550 | return Type.getMethodType(readUTF8(cpInfoOffset, charBuffer)); |
| 3551 | case Symbol.CONSTANT_METHOD_HANDLE_TAG: |
| 3552 | int referenceKind = readByte(cpInfoOffset); |
| 3553 | int referenceCpInfoOffset = cpInfoOffsets[readUnsignedShort(cpInfoOffset + 1)]; |
| 3554 | int nameAndTypeCpInfoOffset = cpInfoOffsets[readUnsignedShort(referenceCpInfoOffset + 2)]; |
| 3555 | String owner = readClass(referenceCpInfoOffset, charBuffer); |
| 3556 | String name = readUTF8(nameAndTypeCpInfoOffset, charBuffer); |
| 3557 | String descriptor = readUTF8(nameAndTypeCpInfoOffset + 2, charBuffer); |
| 3558 | boolean isInterface = |
| 3559 | b[referenceCpInfoOffset - 1] == Symbol.CONSTANT_INTERFACE_METHODREF_TAG; |
| 3560 | return new Handle(referenceKind, owner, name, descriptor, isInterface); |
| 3561 | case Symbol.CONSTANT_DYNAMIC_TAG: |
| 3562 | return readConstantDynamic(constantPoolEntryIndex, charBuffer); |
| 3563 | default: |
| 3564 | throw new IllegalArgumentException(); |
| 3565 | } |
| 3566 | } |
| 3567 | } |
no test coverage detected