提交 6d84f06d 编写于 作者: C Chris Beams

Remove unused MethodMetadata#getMethodReturnType

Introduced to support checking return types on @Bean methods but never
actually used.  May be reintroduced as necessary in the future.
上级 4b5208fa
......@@ -36,11 +36,6 @@ public interface MethodMetadata {
*/
String getMethodName();
/**
* Return the fully-qualified name of the return type of the method.
*/
String getMethodReturnType();
/**
* Return the fully-qualified name of the class that declares this method.
*/
......
......@@ -58,11 +58,7 @@ public class StandardMethodMetadata implements MethodMetadata {
public String getMethodName() {
return this.introspectedMethod.getName();
}
public String getMethodReturnType() {
return this.introspectedMethod.getReturnType().getName();
}
public String getDeclaringClassName() {
return this.introspectedMethod.getDeclaringClass().getName();
}
......
......@@ -62,7 +62,7 @@ final class AnnotationMetadataReadingVisitor extends ClassMetadataReadingVisitor
@Override
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
......@@ -160,47 +160,4 @@ final class AnnotationMetadataReadingVisitor extends ClassMetadataReadingVisitor
annotatedMethods.addAll(list);
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);
}
}
......@@ -43,8 +43,6 @@ final class MethodMetadataReadingVisitor extends MethodAdapter implements Method
private final int access;
private String returnType;
private String declaringClassName;
private final ClassLoader classLoader;
......@@ -53,11 +51,10 @@ final class MethodMetadataReadingVisitor extends MethodAdapter implements Method
private final Map<String, Map<String, Object>> attributeMap = new LinkedHashMap<String, Map<String, Object>>(2);
public MethodMetadataReadingVisitor(String name, String returnType, int access, String declaringClassName, ClassLoader classLoader,
public MethodMetadataReadingVisitor(String name, int access, String declaringClassName, ClassLoader classLoader,
MultiValueMap<String, MethodMetadata> methodMetadataMap) {
super(new EmptyVisitor());
this.name = name;
this.returnType = returnType;
this.access = access;
this.declaringClassName = declaringClassName;
this.classLoader = classLoader;
......@@ -75,10 +72,6 @@ final class MethodMetadataReadingVisitor extends MethodAdapter implements Method
return this.name;
}
public String getMethodReturnType() {
return this.returnType;
}
public boolean isStatic() {
return ((this.access & Opcodes.ACC_STATIC) != 0);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册