private int rank(ITypeBinding type) { if (type.getTypeDeclaration().equals(oldTypeDeclaration)) { return 1; } return 0; } });
private boolean isSuperclass(ITypeBinding type, ITypeBinding candidate) { ITypeBinding superClass = type.getSuperclass().getTypeDeclaration(); candidate = candidate.getTypeDeclaration(); while (null != superClass) { if (superClass == candidate) { return true; } superClass = superClass.getSuperclass(); } return false; }
private int rank(ITypeBinding type) { if (type.getTypeDeclaration().equals(oldTypeDeclaration)) return 1; return 0; } });
private String getSignature(IMethodBinding binding) { StringBuilder buf= new StringBuilder(binding.getName()).append('('); ITypeBinding[] parameterTypes= binding.getParameterTypes(); for (int i= 0; i < parameterTypes.length; i++) { buf.append(parameterTypes[i].getTypeDeclaration().getName()); } buf.append(')'); return buf.toString(); }
public static String qualifiedName(final ITypeBinding declaringClass) { String qn = declaringClass.getTypeDeclaration().getQualifiedName(); if (qn.length() > 0) return qn; else return declaringClass.getQualifiedName(); }
private boolean isValidCSInterface (ITypeBinding type) { if (type.getTypeDeclaration().getQualifiedName().equals("java.util.Iterator") || type.getTypeDeclaration().getQualifiedName().equals("java.lang.Iterable")) return false; if (type.getDeclaredFields().length != 0) return false; for (ITypeBinding ntype : type.getDeclaredTypes()) { if (!isExtractedNestedType(ntype)) return false; } return true; }
private static boolean isTypeInScope(ITypeBinding declaring, ITypeBinding context, boolean includeHierarchy) { ITypeBinding curr= context.getTypeDeclaration(); while (curr != null && curr != declaring) { if (includeHierarchy && isInSuperTypeHierarchy(declaring, curr)) { return true; } curr= curr.getDeclaringClass(); } return curr == declaring; }
public static String getMethodSignature(IMethodBinding binding, boolean inOtherCU) { StringBuffer buf= new StringBuffer(); if (inOtherCU && !binding.isConstructor()) { buf.append(binding.getDeclaringClass().getTypeDeclaration().getName()).append('.'); // simple type name } return BindingLabelProvider.getBindingLabel(binding, BindingLabelProvider.DEFAULT_TEXTFLAGS); }
@Override public boolean visit(ThisExpression node) { final Name qualifier= node.getQualifier(); if (qualifier != null) { final ITypeBinding binding= qualifier.resolveTypeBinding(); if (binding != null && binding != fCurrentType.getTypeDeclaration()) { fSimpleNames.add(qualifier); } } return super.visit(node); }
@Override public boolean visit(ThisExpression node) { final Name qualifier= node.getQualifier(); if (qualifier != null) { final ITypeBinding binding= qualifier.resolveTypeBinding(); if (binding != null && binding != fCurrentType.getTypeDeclaration()) { fSimpleNames.add(qualifier); } } return super.visit(node); }
public boolean visit(TypeDeclaration node) { ITypeBinding binding= node.resolveBinding(); if (binding != null) { binding= binding.getTypeDeclaration(); if (isMovedMember(binding)) return false; } return super.visit(node); }
private IBinding getBindingDeclaration(IBinding binding) { switch (binding.getKind()) { case IBinding.TYPE : return ((ITypeBinding)binding).getTypeDeclaration(); case IBinding.METHOD : return ((IMethodBinding)binding).getMethodDeclaration(); case IBinding.VARIABLE : return ((IVariableBinding)binding).getVariableDeclaration(); default: return binding; } }
public static boolean isAGenericType(ITypeBinding type) { return type.isGenericType() || type.isParameterizedType() || (type.isRawType() && type.getTypeDeclaration().isGenericType()); }
public static boolean isAGenericType(ITypeBinding type) { return type.isGenericType() || type.isParameterizedType() || (type.isRawType() && type.getTypeDeclaration().isGenericType()); }
protected void initialize(ITypeBinding binding, IType javaElementType) { Assert.isTrue(binding.isRawType()); super.initialize(binding, javaElementType); TypeEnvironment environment= getEnvironment(); fTypeDeclaration= (HierarchyType)environment.create(binding.getTypeDeclaration()); }
@Override protected void initialize(ITypeBinding binding, IType javaElementType) { Assert.isTrue(binding.isRawType()); super.initialize(binding, javaElementType); TypeEnvironment environment= getEnvironment(); fTypeDeclaration= (HierarchyType)environment.create(binding.getTypeDeclaration()); }
protected void initialize(ITypeBinding binding, IType javaElementType) { Assert.isTrue(binding.isParameterizedType()); super.initialize(binding, javaElementType); TypeEnvironment environment= getEnvironment(); fTypeDeclaration= (GenericType)environment.create(binding.getTypeDeclaration()); ITypeBinding[] typeArguments= binding.getTypeArguments(); fTypeArguments= new TType[typeArguments.length]; for (int i= 0; i < typeArguments.length; i++) { fTypeArguments[i]= environment.create(typeArguments[i]); } }
@Override protected void initialize(ITypeBinding binding, IType javaElementType) { Assert.isTrue(binding.isParameterizedType()); super.initialize(binding, javaElementType); TypeEnvironment environment= getEnvironment(); fTypeDeclaration= (GenericType)environment.create(binding.getTypeDeclaration()); ITypeBinding[] typeArguments= binding.getTypeArguments(); fTypeArguments= new TType[typeArguments.length]; for (int i= 0; i < typeArguments.length; i++) { fTypeArguments[i]= environment.create(typeArguments[i]); } }
@Override protected void initialize(ITypeBinding binding, IType javaElementType) { Assert.isTrue(binding.isParameterizedType()); super.initialize(binding, javaElementType); TypeEnvironment environment= getEnvironment(); fTypeDeclaration= (GenericType)environment.create(binding.getTypeDeclaration()); ITypeBinding[] typeArguments= binding.getTypeArguments(); fTypeArguments= new TType[typeArguments.length]; for (int i= 0; i < typeArguments.length; i++) { fTypeArguments[i]= environment.create(typeArguments[i]); } }
private CSTypeReferenceExpression mappedMacroTypeReference(ITypeBinding typeUsage, final TypeDeclaration typeDeclaration) { final CSMacro macro = new CSMacro(JavadocUtility.singleTextFragmentFrom(javadocTagFor(typeDeclaration, SharpenAnnotations.SHARPEN_MACRO))); final ITypeBinding[] typeArguments = typeUsage.getTypeArguments(); if (typeArguments.length > 0) { final ITypeBinding[] typeParameters = typeUsage.getTypeDeclaration().getTypeParameters(); for (int i = 0; i < typeParameters.length; i++) { macro.addVariable(typeParameters[i].getName(), mappedTypeReference(typeArguments[i])); } } return new CSMacroTypeReference(macro); }