public static MethodDescriptor fromMethodDeclaration( MethodDeclaration md, BinaryNameResolver resolver) { MethodDescriptor desc = new MethodDescriptor(); for (Object fragment : md.parameters()) { SingleVariableDeclaration parameter = (SingleVariableDeclaration) fragment; Type t = parameter.getType(); if (t.isPrimitiveType()) { PrimitiveType type = (PrimitiveType) t; desc.fParameters.add(DescriptorPart.fromPrimitiveType(type)); } else if (t.isArrayType()) { ArrayType type = (ArrayType) t; desc.fParameters.add(DescriptorPart.fromArrayType(type, resolver)); } else if (t.isSimpleType()) { SimpleType type = (SimpleType) t; desc.fParameters.add(DescriptorPart.fromSimpleType(type, resolver)); } else if (t.isQualifiedType()) { /* QualifiedType type = (QualifiedType) t; System.out.println("DESCRIPTOR QUALIFIED"); */ } else if (t.isNameQualifiedType()) { /* NameQualifiedType type = (NameQualifiedType) t; System.out.println("DESCRIPTOR NAME_QUALIFIED"); */ } } return desc; }
public static MethodDescriptor fromAsmMethodDescriptor(String desc) { MethodDescriptor md = new MethodDescriptor(); org.objectweb.asm.Type[] asmTypes = org.objectweb.asm.Type.getArgumentTypes(desc); for (org.objectweb.asm.Type asmType : asmTypes) { md.fParameters.add(DescriptorPart.fromAsmType(asmType)); } md.fReturnType = DescriptorPart.fromAsmType(org.objectweb.asm.Type.getReturnType(desc)); return md; }