private int getDepth(ITypeBinding binding) { int result= 0; while (binding != null) { binding= binding.getSuperclass(); result++; } return result; } }
private boolean catches(ITypeBinding catchTypeBinding, ITypeBinding throwTypeBinding) { while(throwTypeBinding != null) { if (throwTypeBinding == catchTypeBinding) return true; throwTypeBinding= throwTypeBinding.getSuperclass(); } return false; } }
private int getDepth(ITypeBinding binding) { int result= 0; while (binding != null) { binding= binding.getSuperclass(); result++; } return result; } }
private static boolean isSubtype(ITypeBinding curr, ITypeBinding[] addedExceptions) { while (curr != null) { for (int i= 0; i < addedExceptions.length; i++) { if (curr == addedExceptions[i]) { return true; } } curr= curr.getSuperclass(); } return false; }
private boolean catches(ITypeBinding catchTypeBinding, ITypeBinding throwTypeBinding) { while(throwTypeBinding != null) { if (throwTypeBinding == catchTypeBinding) return true; throwTypeBinding= throwTypeBinding.getSuperclass(); } return false; }
private boolean catches(ITypeBinding catchTypeBinding, ITypeBinding throwTypeBinding) { while(throwTypeBinding != null) { if (throwTypeBinding == catchTypeBinding) return true; throwTypeBinding= throwTypeBinding.getSuperclass(); } return false; } }
private boolean catches(ITypeBinding catchTypeBinding, ITypeBinding throwTypeBinding) { while (throwTypeBinding != null) { if (throwTypeBinding == catchTypeBinding) { return true; } throwTypeBinding = throwTypeBinding.getSuperclass(); } return false; } }
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 boolean hasRelevantBound(ITypeBinding[] bounds) { if (bounds != null) { for (int i= 0; i < bounds.length; i++) if (bounds[i].isInterface() || bounds[i].getSuperclass() != null) return true; } return false; }
static String anonTypeName(ITypeBinding ct) { String binName = ct.getBinaryName(); String dollarSignNumber = binName.substring(binName.indexOf('$')); return "<anonymous subclass of " + ct.getSuperclass().getBinaryName() + '>' + dollarSignNumber; }
private static void addExceptionTypeLinkProposals(LinkedCorrectionProposal proposal, ITypeBinding exc, String key) { // all super classes except Object while (exc != null && !"java.lang.Object".equals(exc.getQualifiedName())) { //$NON-NLS-1$ proposal.addLinkedPositionProposal(key, exc); exc = exc.getSuperclass(); } }
public static IMethodBinding findOverriddenMethodInTypeOrSuperclasses(ITypeBinding type, IMethodBinding method) { IMethodBinding found = findOverriddenMethodInType(type, method); if (null != found) { return found; } ITypeBinding superClass = type.getSuperclass(); if (null != superClass) { return findOverriddenMethodInTypeOrSuperclasses(superClass, method); } return null; }
ITypeBinding mapTypeParameterExtendedType (ITypeBinding tb) { ITypeBinding superc = tb.getSuperclass(); if (superc != null && !superc.getQualifiedName().equals("java.lang.Object") && !superc.getQualifiedName().equals("java.lang.Enum<?>")) { return superc; } ITypeBinding[] ints = tb.getInterfaces(); if (ints.length > 0) return ints[0]; return null; }
private boolean matches(ITypeBinding exception) { if (exception == null) return false; if (isCaught(exception)) return false; while (exception != null) { if (Bindings.equals(fException, exception)) return true; exception= exception.getSuperclass(); } return false; }
private ITypeBinding getSuperTypeBinding() { ITypeBinding types= fAnonymousInnerClassNode.resolveBinding(); ITypeBinding[] interfaces= types.getInterfaces(); if (interfaces.length > 0) return interfaces[0]; else return types.getSuperclass(); }
private static boolean hasMethodWithName(ITypeBinding typeBinding, String name) { IVariableBinding[] fields= typeBinding.getDeclaredFields(); for (int i= 0; i < fields.length; i++) { if (fields[i].getName().equals(name)) { return true; } } ITypeBinding superclass= typeBinding.getSuperclass(); if (superclass != null) { return hasMethodWithName(superclass, name); } return false; }
public ITypeBinding anonymousBaseType() { ITypeBinding binding = nestedTypeBinding(); return binding.getInterfaces().length > 0 ? binding.getInterfaces()[0] : binding.getSuperclass(); }
private boolean isLegacyTestFixture (ITypeBinding type) { if (!_configuration.junitConversion()) return false; if (isLegacyTestFixtureClass (type)) return true; ITypeBinding base = type.getSuperclass(); return (base != null) && isLegacyTestFixture (base); }
private boolean needsNoSuperCall(ITypeBinding typeBinding, String name, ITypeBinding[] parameters) { Assert.isNotNull(typeBinding); IMethodBinding binding= Bindings.findMethodInHierarchy(typeBinding.getSuperclass(), name, parameters); if (binding != null && !Modifier.isAbstract(binding.getModifiers())) { ITypeBinding declaring= binding.getDeclaringClass(); return declaring.getQualifiedName().equals(JAVA_LANG_OBJECT); } return true; }
private static void findOverridenMethods(IMethodBinding overridingMethod, Set<IMethodBinding> results, ITypeBinding declaringClass) { final ITypeBinding superclass = declaringClass.getSuperclass(); if (superclass != null && !addOverridenMethods(overridingMethod, superclass, results)) { findOverridenMethods(overridingMethod, results, superclass); } for (ITypeBinding itf : declaringClass.getInterfaces()) { if (!addOverridenMethods(overridingMethod, itf, results)) { findOverridenMethods(overridingMethod, results, itf); } } }