private MethodInfo readMethod() throws IOException { MethodInfo methodInfo = new MethodInfo(); methodInfo.setAccessFlags(is.readUnsignedShort()); methodInfo.setNameIndex(is.readUnsignedShort()); methodInfo.setDescriptorIndex(is.readUnsignedShort()); int attributesCount = is.readUnsignedShort(); methodInfo.setAttributes(new AbstractAttribute[attributesCount]); for (int i = 0; i < attributesCount; i++) { AbstractAttribute attribute = attributeFacility.readAttribute(); if (isInterceptorAnnotation(attribute)) { methodInfo.setInterceptorClass( ((RuntimeInvisibleAnnotations) attribute).getInterceptorClass()); } methodInfo.getAttributes()[i] = attribute; if (attribute.getClass() == Code.class) { methodInfo.setCode((Code) attribute); } } methodInfo.setSignature(getMethodSignature(methodInfo)); methodInfo.setMethodName(constantPool.getUtf8(methodInfo.getNameIndex()).getString()); return methodInfo; }
private boolean isInterceptorAnnotation(AbstractAttribute attribute) throws InvalidClassException { return attribute.getClass() == RuntimeInvisibleAnnotations.class && ((RuntimeInvisibleAnnotations) attribute).getInterceptorClass() != null; }