/** * Returns the bytecode offset corresponding to the specified JVMS 'type_annotation' structure, or * -1 if there is no such type_annotation of if it does not have a bytecode offset. * * @param typeAnnotationOffsets the offset of each 'type_annotation' entry in a * Runtime[In]VisibleTypeAnnotations attribute, or null. * @param typeAnnotationIndex the index a 'type_annotation' entry in typeAnnotationOffsets. * @return bytecode offset corresponding to the specified JVMS 'type_annotation' structure, or -1 * if there is no such type_annotation of if it does not have a bytecode offset. */ private int getTypeAnnotationBytecodeOffset( final int[] typeAnnotationOffsets, final int typeAnnotationIndex) { if (typeAnnotationOffsets == null || typeAnnotationIndex >= typeAnnotationOffsets.length || readByte(typeAnnotationOffsets[typeAnnotationIndex]) < TypeReference.INSTANCEOF) { return -1; } return readUnsignedShort(typeAnnotationOffsets[typeAnnotationIndex] + 1); }
int tag = classReader.readByte(offset);
int pathLength = readByte(currentOffset); context.currentTypeAnnotationTargetPath = pathLength == 0 ? null : new TypePath(b, currentOffset);
return Type.getMethodType(readUTF8(cpInfoOffset, charBuffer)); case Symbol.CONSTANT_METHOD_HANDLE_TAG: int referenceKind = readByte(cpInfoOffset); int referenceCpInfoOffset = cpInfoOffsets[readUnsignedShort(cpInfoOffset + 1)]; int nameAndTypeCpInfoOffset = cpInfoOffsets[readUnsignedShort(referenceCpInfoOffset + 2)];
int parametersCount = readByte(methodParametersOffset); int currentParameterOffset = methodParametersOffset + 1; while (parametersCount-- > 0) {
int pathLength = readByte(currentOffset); if ((targetType >>> 24) == TypeReference.EXCEPTION_PARAMETER) {
addConstantMethodHandle( itemIndex, classReader.readByte(itemOffset), classReader.readClass(memberRefItemOffset, charBuffer), classReader.readUTF8(nameAndTypeItemOffset, charBuffer),
/** * Returns the bytecode offset corresponding to the specified JVMS 'type_annotation' structure, or * -1 if there is no such type_annotation of if it does not have a bytecode offset. * * @param typeAnnotationOffsets the offset of each 'type_annotation' entry in a * Runtime[In]VisibleTypeAnnotations attribute, or null. * @param typeAnnotationIndex the index a 'type_annotation' entry in typeAnnotationOffsets. * @return bytecode offset corresponding to the specified JVMS 'type_annotation' structure, or -1 * if there is no such type_annotation of if it does not have a bytecode offset. */ private int getTypeAnnotationBytecodeOffset( final int[] typeAnnotationOffsets, final int typeAnnotationIndex) { if (typeAnnotationOffsets == null || typeAnnotationIndex >= typeAnnotationOffsets.length || readByte(typeAnnotationOffsets[typeAnnotationIndex]) < TypeReference.INSTANCEOF) { return -1; } return readUnsignedShort(typeAnnotationOffsets[typeAnnotationIndex] + 1); }
/** * Returns the bytecode offset corresponding to the specified JVMS 'type_annotation' structure, or * -1 if there is no such type_annotation of if it does not have a bytecode offset. * * @param typeAnnotationOffsets the offset of each 'type_annotation' entry in a * Runtime[In]VisibleTypeAnnotations attribute, or null. * @param typeAnnotationIndex the index a 'type_annotation' entry in typeAnnotationOffsets. * @return bytecode offset corresponding to the specified JVMS 'type_annotation' structure, or -1 * if there is no such type_annotation of if it does not have a bytecode offset. */ private int getTypeAnnotationBytecodeOffset( final int[] typeAnnotationOffsets, final int typeAnnotationIndex) { if (typeAnnotationOffsets == null || typeAnnotationIndex >= typeAnnotationOffsets.length || readByte(typeAnnotationOffsets[typeAnnotationIndex]) < TypeReference.INSTANCEOF) { return -1; } return readUnsignedShort(typeAnnotationOffsets[typeAnnotationIndex] + 1); }
/** * Returns the bytecode offset corresponding to the specified JVMS 'type_annotation' structure, or * -1 if there is no such type_annotation of if it does not have a bytecode offset. * * @param typeAnnotationOffsets the offset of each 'type_annotation' entry in a * Runtime[In]VisibleTypeAnnotations attribute, or null. * @param typeAnnotationIndex the index a 'type_annotation' entry in typeAnnotationOffsets. * @return bytecode offset corresponding to the specified JVMS 'type_annotation' structure, or -1 * if there is no such type_annotation of if it does not have a bytecode offset. */ private int getTypeAnnotationBytecodeOffset( final int[] typeAnnotationOffsets, final int typeAnnotationIndex) { if (typeAnnotationOffsets == null || typeAnnotationIndex >= typeAnnotationOffsets.length || readByte(typeAnnotationOffsets[typeAnnotationIndex]) < TypeReference.INSTANCEOF) { return -1; } return readUnsignedShort(typeAnnotationOffsets[typeAnnotationIndex] + 1); }
@Override protected Attribute read( final ClassReader classReader, final int offset, final int length, final char[] charBuffer, final int codeAttributeOffset, final Label[] labels) { int currentOffset = offset; String hashAlgorithm = classReader.readUTF8(currentOffset, charBuffer); currentOffset += 2; int numModules = classReader.readUnsignedShort(currentOffset); currentOffset += 2; ArrayList<String> moduleList = new ArrayList<String>(numModules); ArrayList<byte[]> hashList = new ArrayList<byte[]>(numModules); for (int i = 0; i < numModules; ++i) { String module = classReader.readModule(currentOffset, charBuffer); currentOffset += 2; moduleList.add(module); int hashLength = classReader.readUnsignedShort(currentOffset); currentOffset += 2; byte[] hash = new byte[hashLength]; for (int j = 0; j < hashLength; ++j) { hash[j] = (byte) (classReader.readByte(currentOffset) & 0xFF); currentOffset += 1; } hashList.add(hash); } return new ModuleHashesAttribute(hashAlgorithm, moduleList, hashList); }
@Override protected Attribute read( final ClassReader classReader, final int offset, final int length, final char[] charBuffer, final int codeAttributeOffset, final Label[] labels) { int currentOffset = offset; String hashAlgorithm = classReader.readUTF8(currentOffset, charBuffer); currentOffset += 2; int numModules = classReader.readUnsignedShort(currentOffset); currentOffset += 2; ArrayList<String> moduleList = new ArrayList<String>(numModules); ArrayList<byte[]> hashList = new ArrayList<byte[]>(numModules); for (int i = 0; i < numModules; ++i) { String module = classReader.readModule(currentOffset, charBuffer); currentOffset += 2; moduleList.add(module); int hashLength = classReader.readUnsignedShort(currentOffset); currentOffset += 2; byte[] hash = new byte[hashLength]; for (int j = 0; j < hashLength; ++j) { hash[j] = (byte) (classReader.readByte(currentOffset) & 0xFF); currentOffset += 1; } hashList.add(hash); } return new ModuleHashesAttribute(hashAlgorithm, moduleList, hashList); }
@Override protected Attribute read( final ClassReader classReader, final int offset, final int length, final char[] charBuffer, final int codeAttributeOffset, final Label[] labels) { int currentOffset = offset; String hashAlgorithm = classReader.readUTF8(currentOffset, charBuffer); currentOffset += 2; int numModules = classReader.readUnsignedShort(currentOffset); currentOffset += 2; ArrayList<String> moduleList = new ArrayList<String>(numModules); ArrayList<byte[]> hashList = new ArrayList<byte[]>(numModules); for (int i = 0; i < numModules; ++i) { String module = classReader.readModule(currentOffset, charBuffer); currentOffset += 2; moduleList.add(module); int hashLength = classReader.readUnsignedShort(currentOffset); currentOffset += 2; byte[] hash = new byte[hashLength]; for (int j = 0; j < hashLength; ++j) { hash[j] = (byte) (classReader.readByte(currentOffset) & 0xFF); currentOffset += 1; } hashList.add(hash); } return new ModuleHashesAttribute(hashAlgorithm, moduleList, hashList); }
int pathLength = readByte(currentOffset); context.currentTypeAnnotationTargetPath = pathLength == 0 ? null : new TypePath(b, currentOffset);
return Type.getMethodType(readUTF8(cpInfoOffset, charBuffer)); case Symbol.CONSTANT_METHOD_HANDLE_TAG: int referenceKind = readByte(cpInfoOffset); int referenceCpInfoOffset = cpInfoOffsets[readUnsignedShort(cpInfoOffset + 1)]; int nameAndTypeCpInfoOffset = cpInfoOffsets[readUnsignedShort(referenceCpInfoOffset + 2)];
return Type.getMethodType(readUTF8(cpInfoOffset, charBuffer)); case Symbol.CONSTANT_METHOD_HANDLE_TAG: int referenceKind = readByte(cpInfoOffset); int referenceCpInfoOffset = cpInfoOffsets[readUnsignedShort(cpInfoOffset + 1)]; int nameAndTypeCpInfoOffset = cpInfoOffsets[readUnsignedShort(referenceCpInfoOffset + 2)];
return Type.getMethodType(readUTF8(cpInfoOffset, charBuffer)); case Symbol.CONSTANT_METHOD_HANDLE_TAG: int referenceKind = readByte(cpInfoOffset); int referenceCpInfoOffset = cpInfoOffsets[readUnsignedShort(cpInfoOffset + 1)]; int nameAndTypeCpInfoOffset = cpInfoOffsets[readUnsignedShort(referenceCpInfoOffset + 2)];
return Type.getMethodType(readUTF8(index, buf)); default: // case ClassWriter.HANDLE_BASE + [1..9]: int tag = readByte(index); int[] items = this.items; int cpIndex = items[readUnsignedShort(index + 1)];
return Type.getMethodType(readUTF8(index, buf)); default: // case ClassWriter.HANDLE_BASE + [1..9]: int tag = readByte(index); int[] items = this.items; int cpIndex = items[readUnsignedShort(index + 1)];