public static SignatureWrapper getGenericSignature(IBinaryMethod next) { char[] signature = next.getGenericSignature(); if (signature == null) { signature = next.getMethodDescriptor(); } return new SignatureWrapper(signature); }
public static SignatureWrapper getGenericSignature(IBinaryMethod next) { char[] signature = next.getGenericSignature(); if (signature == null) { signature = next.getMethodDescriptor(); } return new SignatureWrapper(signature); }
private String getReturnType(IBinaryMethod info) { char[] genericSignature = info.getGenericSignature(); char[] signature = genericSignature == null ? info.getMethodDescriptor() : genericSignature; char[] dotBasedSignature = CharOperation.replaceOnCopy(signature, '/', '.'); String returnTypeName= Signature.getReturnType(new String(dotBasedSignature)); return new String(ClassFile.translatedName(returnTypeName.toCharArray())); } /*
private String getReturnType(IBinaryMethod info) { char[] genericSignature = info.getGenericSignature(); char[] signature = genericSignature == null ? info.getMethodDescriptor() : genericSignature; char[] dotBasedSignature = CharOperation.replaceOnCopy(signature, '/', '.'); String returnTypeName= Signature.getReturnType(new String(dotBasedSignature)); return new String(ClassFile.translatedName(returnTypeName.toCharArray())); } /*
private String getReturnType(IBinaryMethod info) { char[] genericSignature = info.getGenericSignature(); char[] signature = genericSignature == null ? info.getMethodDescriptor() : genericSignature; char[] dotBasedSignature = CharOperation.replaceOnCopy(signature, '/', '.'); String returnTypeName= Signature.getReturnType(new String(dotBasedSignature)); return new String(ClassFile.translatedName(returnTypeName.toCharArray())); } /*
private String getReturnType(IBinaryMethod info) { char[] genericSignature = info.getGenericSignature(); char[] signature = genericSignature == null ? info.getMethodDescriptor() : genericSignature; char[] dotBasedSignature = CharOperation.replaceOnCopy(signature, '/', '.'); String returnTypeName= Signature.getReturnType(new String(dotBasedSignature)); return new String(ClassFile.translatedName(returnTypeName.toCharArray())); } /*
private String getReturnType(IBinaryMethod info) { char[] genericSignature = info.getGenericSignature(); char[] signature = genericSignature == null ? info.getMethodDescriptor() : genericSignature; char[] dotBasedSignature = CharOperation.replaceOnCopy(signature, '/', '.'); String returnTypeName= Signature.getReturnType(new String(dotBasedSignature)); return new String(ClassFile.translatedName(returnTypeName.toCharArray())); } /*
private String getReturnType(IBinaryMethod info) { char[] genericSignature = info.getGenericSignature(); char[] signature = genericSignature == null ? info.getMethodDescriptor() : genericSignature; char[] dotBasedSignature = CharOperation.replaceOnCopy(signature, '/', '.'); String returnTypeName= Signature.getReturnType(new String(dotBasedSignature)); return new String(ClassFile.translatedName(returnTypeName.toCharArray())); } /*
/** * @see IMethod#getTypeParameterSignatures() * @since 3.0 * @deprecated */ public String[] getTypeParameterSignatures() throws JavaModelException { IBinaryMethod info = (IBinaryMethod) getElementInfo(); char[] genericSignature = info.getGenericSignature(); if (genericSignature == null) return CharOperation.NO_STRINGS; char[] dotBasedSignature = CharOperation.replaceOnCopy(genericSignature, '/', '.'); char[][] typeParams = Signature.getTypeParameters(dotBasedSignature); return CharOperation.toStrings(typeParams); }
/** * @see IMethod#getTypeParameterSignatures() * @since 3.0 * @deprecated */ public String[] getTypeParameterSignatures() throws JavaModelException { IBinaryMethod info = (IBinaryMethod) getElementInfo(); char[] genericSignature = info.getGenericSignature(); if (genericSignature == null) return CharOperation.NO_STRINGS; char[] dotBasedSignature = CharOperation.replaceOnCopy(genericSignature, '/', '.'); char[][] typeParams = Signature.getTypeParameters(dotBasedSignature); return CharOperation.toStrings(typeParams); }
/** * @see IMethod#getTypeParameterSignatures() * @since 3.0 * @deprecated */ @Override public String[] getTypeParameterSignatures() throws JavaModelException { IBinaryMethod info = (IBinaryMethod) getElementInfo(); char[] genericSignature = info.getGenericSignature(); if (genericSignature == null) return CharOperation.NO_STRINGS; char[] dotBasedSignature = CharOperation.replaceOnCopy(genericSignature, '/', '.'); char[][] typeParams = Signature.getTypeParameters(dotBasedSignature); return CharOperation.toStrings(typeParams); }
/** * @see IMethod#getTypeParameterSignatures() * @since 3.0 * @deprecated */ public String[] getTypeParameterSignatures() throws JavaModelException { IBinaryMethod info = (IBinaryMethod) getElementInfo(); char[] genericSignature = info.getGenericSignature(); if (genericSignature == null) return CharOperation.NO_STRINGS; char[] dotBasedSignature = CharOperation.replaceOnCopy(genericSignature, '/', '.'); char[][] typeParams = Signature.getTypeParameters(dotBasedSignature); return CharOperation.toStrings(typeParams); }
/** * @see IMethod#getTypeParameterSignatures() * @since 3.0 * @deprecated */ public String[] getTypeParameterSignatures() throws JavaModelException { IBinaryMethod info = (IBinaryMethod) getElementInfo(); char[] genericSignature = info.getGenericSignature(); if (genericSignature == null) return CharOperation.NO_STRINGS; char[] dotBasedSignature = CharOperation.replaceOnCopy(genericSignature, '/', '.'); char[][] typeParams = Signature.getTypeParameters(dotBasedSignature); return CharOperation.toStrings(typeParams); }
/** * @see IMethod#getTypeParameterSignatures() * @since 3.0 * @deprecated */ public String[] getTypeParameterSignatures() throws JavaModelException { IBinaryMethod info = (IBinaryMethod) getElementInfo(); char[] genericSignature = info.getGenericSignature(); if (genericSignature == null) return CharOperation.NO_STRINGS; char[] dotBasedSignature = CharOperation.replaceOnCopy(genericSignature, '/', '.'); char[][] typeParams = Signature.getTypeParameters(dotBasedSignature); return CharOperation.toStrings(typeParams); }
IMethod createBinaryMethodHandle(IType type, char[] methodSelector, char[][] argumentTypeNames) { ClassFileReader reader = MatchLocator.classFileReader(type); if (reader != null) { IBinaryMethod[] methods = reader.getMethods(); if (methods != null) { int argCount = argumentTypeNames == null ? 0 : argumentTypeNames.length; nextMethod : for (int i = 0, methodsLength = methods.length; i < methodsLength; i++) { IBinaryMethod binaryMethod = methods[i]; char[] selector = binaryMethod.isConstructor() ? type.getElementName().toCharArray() : binaryMethod.getSelector(); if (CharOperation.equals(selector, methodSelector)) { char[] signature = binaryMethod.getGenericSignature(); if (signature == null) signature = binaryMethod.getMethodDescriptor(); char[][] parameterTypes = Signature.getParameterTypes(signature); if (argCount != parameterTypes.length) continue nextMethod; if (argumentTypeNames != null) { for (int j = 0; j < argCount; j++) { char[] parameterTypeName = ClassFileMatchLocator.convertClassFileFormat(parameterTypes[j]); if (!CharOperation.endsWith(Signature.toCharArray(Signature.getTypeErasure(parameterTypeName)), CharOperation.replaceOnCopy(argumentTypeNames[j], '$', '.'))) continue nextMethod; parameterTypes[j] = parameterTypeName; } } return (IMethod) createMethodHandle(type, new String(selector), CharOperation.toStrings(parameterTypes)); } } } } return null; } /*
@Override public ITypeAnnotationWalker enrichWithExternalAnnotationsFor(ITypeAnnotationWalker walker, Object member, LookupEnvironment environment) { if (walker == ITypeAnnotationWalker.EMPTY_ANNOTATION_WALKER && this.annotationProvider != null) { if (member == null) { return this.annotationProvider.forTypeHeader(environment); } else if (member instanceof IBinaryField) { IBinaryField field = (IBinaryField) member; char[] fieldSignature = field.getGenericSignature(); if (fieldSignature == null) fieldSignature = field.getTypeName(); return this.annotationProvider.forField(field.getName(), fieldSignature, environment); } else if (member instanceof IBinaryMethod) { IBinaryMethod method = (IBinaryMethod) member; char[] methodSignature = method.getGenericSignature(); if (methodSignature == null) methodSignature = method.getMethodDescriptor(); return this.annotationProvider.forMethod( method.isConstructor() ? TypeConstants.INIT : method.getSelector(), methodSignature, environment); } } return walker; }
@Override public ITypeAnnotationWalker enrichWithExternalAnnotationsFor(ITypeAnnotationWalker walker, Object member, LookupEnvironment environment) { if (walker == ITypeAnnotationWalker.EMPTY_ANNOTATION_WALKER && this.annotationProvider != null) { if (member == null) { return this.annotationProvider.forTypeHeader(environment); } else if (member instanceof IBinaryField) { IBinaryField field = (IBinaryField) member; char[] fieldSignature = field.getGenericSignature(); if (fieldSignature == null) fieldSignature = field.getTypeName(); return this.annotationProvider.forField(field.getName(), fieldSignature, environment); } else if (member instanceof IBinaryMethod) { IBinaryMethod method = (IBinaryMethod) member; char[] methodSignature = method.getGenericSignature(); if (methodSignature == null) methodSignature = method.getMethodDescriptor(); return this.annotationProvider.forMethod( method.isConstructor() ? TypeConstants.INIT : method.getSelector(), methodSignature, environment); } } return walker; }
/** * Conditionally add external annotations to the mix. * If 'member' is given it must be either of IBinaryField or IBinaryMethod, in which case we're seeking annotations for that member. * Otherwise we're seeking annotations for top-level elements of a type (type parameters & super types). */ @Override public ITypeAnnotationWalker enrichWithExternalAnnotationsFor(ITypeAnnotationWalker walker, Object member, LookupEnvironment environment) { if (walker == ITypeAnnotationWalker.EMPTY_ANNOTATION_WALKER && this.annotationProvider != null) { if (member == null) { return this.annotationProvider.forTypeHeader(environment); } else if (member instanceof IBinaryField) { IBinaryField field = (IBinaryField) member; char[] fieldSignature = field.getGenericSignature(); if (fieldSignature == null) fieldSignature = field.getTypeName(); return this.annotationProvider.forField(field.getName(), fieldSignature, environment); } else if (member instanceof IBinaryMethod) { IBinaryMethod method = (IBinaryMethod) member; char[] methodSignature = method.getGenericSignature(); if (methodSignature == null) methodSignature = method.getMethodDescriptor(); return this.annotationProvider.forMethod(method.isConstructor() ? TypeConstants.INIT : method.getSelector(), methodSignature, environment); } } return walker; }
/** * Conditionally add external annotations to the mix. * If 'member' is given it must be either of IBinaryField or IBinaryMethod, in which case we're seeking annotations for that member. * Otherwise we're seeking annotations for top-level elements of a type (type parameters & super types). */ @Override public ITypeAnnotationWalker enrichWithExternalAnnotationsFor(ITypeAnnotationWalker walker, Object member, LookupEnvironment environment) { if (walker == ITypeAnnotationWalker.EMPTY_ANNOTATION_WALKER && this.annotationProvider != null) { if (member == null) { return this.annotationProvider.forTypeHeader(environment); } else if (member instanceof IBinaryField) { IBinaryField field = (IBinaryField) member; char[] fieldSignature = field.getGenericSignature(); if (fieldSignature == null) fieldSignature = field.getTypeName(); return this.annotationProvider.forField(field.getName(), fieldSignature, environment); } else if (member instanceof IBinaryMethod) { IBinaryMethod method = (IBinaryMethod) member; char[] methodSignature = method.getGenericSignature(); if (methodSignature == null) methodSignature = method.getMethodDescriptor(); return this.annotationProvider.forMethod(method.isConstructor() ? TypeConstants.INIT : method.getSelector(), methodSignature, environment); } } return walker; }
/** * Conditionally add external annotations to the mix. * If 'member' is given it must be either of IBinaryField or IBinaryMethod, in which case we're seeking annotations for that member. * Otherwise we're seeking annotations for top-level elements of a type (type parameters & super types). */ @Override public ITypeAnnotationWalker enrichWithExternalAnnotationsFor(ITypeAnnotationWalker walker, Object member, LookupEnvironment environment) { if (walker == ITypeAnnotationWalker.EMPTY_ANNOTATION_WALKER && this.annotationProvider != null) { if (member == null) { return this.annotationProvider.forTypeHeader(environment); } else if (member instanceof IBinaryField) { IBinaryField field = (IBinaryField) member; char[] fieldSignature = field.getGenericSignature(); if (fieldSignature == null) fieldSignature = field.getTypeName(); return this.annotationProvider.forField(field.getName(), fieldSignature, environment); } else if (member instanceof IBinaryMethod) { IBinaryMethod method = (IBinaryMethod) member; char[] methodSignature = method.getGenericSignature(); if (methodSignature == null) methodSignature = method.getMethodDescriptor(); return this.annotationProvider.forMethod(method.isConstructor() ? TypeConstants.INIT : method.getSelector(), methodSignature, environment); } } return walker; }