|
|
|
@ -62,7 +62,7 @@ final class AnnotationMetadataReadingVisitor extends ClassMetadataReadingVisitor |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { |
|
|
|
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { |
|
|
|
return new MethodMetadataReadingVisitor(name, getReturnTypeFromAsmMethodDescriptor(desc), access, this.getClassName(), this.classLoader, this.methodMetadataMap); |
|
|
|
return new MethodMetadataReadingVisitor(name, access, this.getClassName(), this.classLoader, this.methodMetadataMap); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
@ -160,47 +160,4 @@ final class AnnotationMetadataReadingVisitor extends ClassMetadataReadingVisitor |
|
|
|
annotatedMethods.addAll(list); |
|
|
|
annotatedMethods.addAll(list); |
|
|
|
return annotatedMethods; |
|
|
|
return annotatedMethods; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Convert a type descriptor to a classname suitable for classloading with |
|
|
|
|
|
|
|
* Class.forName(). |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param typeDescriptor see ASM guide section 2.1.3 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private static String convertAsmTypeDescriptorToClassName(String typeDescriptor) { |
|
|
|
|
|
|
|
final String internalName; // See ASM guide section 2.1.2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ("V".equals(typeDescriptor)) |
|
|
|
|
|
|
|
return Void.class.getName(); |
|
|
|
|
|
|
|
if ("I".equals(typeDescriptor)) |
|
|
|
|
|
|
|
return Integer.class.getName(); |
|
|
|
|
|
|
|
if ("Z".equals(typeDescriptor)) |
|
|
|
|
|
|
|
return Boolean.class.getName(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// strip the leading array/object/primitive identifier
|
|
|
|
|
|
|
|
if (typeDescriptor.startsWith("[[")) |
|
|
|
|
|
|
|
internalName = typeDescriptor.substring(3); |
|
|
|
|
|
|
|
else if (typeDescriptor.startsWith("[")) |
|
|
|
|
|
|
|
internalName = typeDescriptor.substring(2); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
internalName = typeDescriptor.substring(1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// convert slashes to dots
|
|
|
|
|
|
|
|
String className = internalName.replace('/', '.'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// and strip trailing semicolon (if present)
|
|
|
|
|
|
|
|
if (className.endsWith(";")) |
|
|
|
|
|
|
|
className = className.substring(0, internalName.length() - 1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return className; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* @param methodDescriptor see ASM guide section 2.1.4 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private static String getReturnTypeFromAsmMethodDescriptor(String methodDescriptor) { |
|
|
|
|
|
|
|
String returnTypeDescriptor = methodDescriptor.substring(methodDescriptor.indexOf(')') + 1); |
|
|
|
|
|
|
|
return convertAsmTypeDescriptorToClassName(returnTypeDescriptor); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|