private static IMethodBinding findMethod(IMethodBinding methodBinding, ITypeBinding type) { if (methodBinding.getDeclaringClass().equals(type)) return methodBinding; return Bindings.findOverriddenMethodInType(type, methodBinding); }
protected static IMethodBinding findMethod(IMethodBinding methodBinding, ITypeBinding type) { if (methodBinding.getDeclaringClass().equals(type)) return methodBinding; return Bindings.findOverriddenMethodInType(type, methodBinding); }
private static IMethodBinding findMethod(IMethodBinding methodBinding, ITypeBinding type) { if (methodBinding.getDeclaringClass().equals(type)) return methodBinding; return Bindings.findOverriddenMethodInType(type, methodBinding); }
protected static IMethodBinding findMethod(IMethodBinding methodBinding, ITypeBinding type) { if (methodBinding.getDeclaringClass().equals(type)) return methodBinding; return Bindings.findOverriddenMethodInType(type, methodBinding); }
private static IMethodBinding findMethod(IMethodBinding methodBinding, ITypeBinding type) { if (methodBinding.getDeclaringClass().equals(type)) return methodBinding; return Bindings.findOverriddenMethodInType(type, methodBinding); }
protected static IMethodBinding findMethod(IMethodBinding methodBinding, ITypeBinding type) { if (methodBinding.getDeclaringClass().equals(type)) return methodBinding; return Bindings.findOverriddenMethodInType(type, methodBinding); }
/** * Returns the functional interface method being implemented by the given method reference. * * @param methodReference the method reference to get the functional method * @return the functional interface method being implemented by <code>methodReference</code> or * <code>null</code> if it could not be derived */ public static IMethodBinding getFunctionalMethodForMethodReference(MethodReference methodReference) { ITypeBinding targetTypeBinding= ASTNodes.getTargetType(methodReference); if (targetTypeBinding == null) return null; IMethodBinding functionalMethod= targetTypeBinding.getFunctionalInterfaceMethod(); if (functionalMethod.isSynthetic()) { functionalMethod= Bindings.findOverriddenMethodInType(functionalMethod.getDeclaringClass(), functionalMethod); } return functionalMethod; }
/** * Returns the functional interface method being implemented by the given method reference. * * @param methodReference the method reference to get the functional method * @return the functional interface method being implemented by <code>methodReference</code> or * <code>null</code> if it could not be derived */ public static IMethodBinding getFunctionalMethodForMethodReference(MethodReference methodReference) { ITypeBinding targetTypeBinding= ASTNodes.getTargetType(methodReference); if (targetTypeBinding == null) return null; IMethodBinding functionalMethod= targetTypeBinding.getFunctionalInterfaceMethod(); if (functionalMethod.isSynthetic()) { functionalMethod= Bindings.findOverriddenMethodInType(functionalMethod.getDeclaringClass(), functionalMethod); } return functionalMethod; }
/** * Returns the functional interface method being implemented by the given method * reference. * * @param methodReference * the method reference to get the functional method * @return the functional interface method being implemented by * <code>methodReference</code> or <code>null</code> if it could not be * derived */ public static IMethodBinding getFunctionalMethodForMethodReference(MethodReference methodReference) { ITypeBinding targetTypeBinding = ASTNodes.getTargetType(methodReference); if (targetTypeBinding == null) { return null; } IMethodBinding functionalMethod = targetTypeBinding.getFunctionalInterfaceMethod(); if (functionalMethod.isSynthetic()) { functionalMethod = Bindings.findOverriddenMethodInType(functionalMethod.getDeclaringClass(), functionalMethod); } return functionalMethod; }
/** * Finds a method in the hierarchy of <code>type</code> that is overridden by <code>binding</code>. * Returns <code>null</code> if no such method exists. If the method is defined in more than one super type only the first match is * returned. First the super class is examined and then the implemented interfaces. * @param type The type to search the method in * @param binding The method that overrides * @return the method binding overridden the method */ public static IMethodBinding findOverriddenMethodInHierarchy(ITypeBinding type, IMethodBinding binding) { IMethodBinding method= findOverriddenMethodInType(type, binding); if (method != null) return method; ITypeBinding superClass= type.getSuperclass(); if (superClass != null) { method= findOverriddenMethodInHierarchy(superClass, binding); if (method != null) return method; } ITypeBinding[] interfaces= type.getInterfaces(); for (int i= 0; i < interfaces.length; i++) { method= findOverriddenMethodInHierarchy(interfaces[i], binding); if (method != null) return method; } return null; }
/** * Finds a method in the hierarchy of <code>type</code> that is overridden by <code>binding</code>. * Returns <code>null</code> if no such method exists. If the method is defined in more than one super type only the first match is * returned. First the super class is examined and then the implemented interfaces. * @param type The type to search the method in * @param binding The method that overrides * @return the method binding overridden the method */ public static IMethodBinding findOverriddenMethodInHierarchy(ITypeBinding type, IMethodBinding binding) { IMethodBinding method= findOverriddenMethodInType(type, binding); if (method != null) return method; ITypeBinding superClass= type.getSuperclass(); if (superClass != null) { method= findOverriddenMethodInHierarchy(superClass, binding); if (method != null) return method; } ITypeBinding[] interfaces= type.getInterfaces(); for (int i= 0; i < interfaces.length; i++) { method= findOverriddenMethodInHierarchy(interfaces[i], binding); if (method != null) return method; } return null; }
/** * Finds a method in the hierarchy of <code>type</code> that is overridden by </code>binding</code>. * Returns <code>null</code> if no such method exists. If the method is defined in more than one super type only the first match is * returned. First the super class is examined and than the implemented interfaces. * @param type The type to search the method in * @param binding The method that overrides * @return the method binding overridden the method */ public static IMethodBinding findOverriddenMethodInHierarchy(ITypeBinding type, IMethodBinding binding) { IMethodBinding method= findOverriddenMethodInType(type, binding); if (method != null) return method; ITypeBinding superClass= type.getSuperclass(); if (superClass != null) { method= findOverriddenMethodInHierarchy(superClass, binding); if (method != null) return method; } ITypeBinding[] interfaces= type.getInterfaces(); for (int i= 0; i < interfaces.length; i++) { method= findOverriddenMethodInHierarchy(interfaces[i], binding); if (method != null) return method; } return null; }
private void addConstraintsForOverriding(IMethodBinding methodBinding, ConstraintVariable2 returnTypeCv, ConstraintVariable2[] parameterTypeCvs) { boolean hasParameterElementCvs= false; for (int i= 0; i < parameterTypeCvs.length; i++) if (parameterTypeCvs[i] != null) hasParameterElementCvs= true; if (returnTypeCv == null && ! hasParameterElementCvs) return; ITypeBinding[] allSuperTypes= Bindings.getAllSuperTypes(methodBinding.getDeclaringClass()); for (int i= 0; i < allSuperTypes.length; i++) { ITypeBinding superType= allSuperTypes[i]; IMethodBinding superMethod= Bindings.findOverriddenMethodInType(superType, methodBinding); if (superMethod == null) continue; for (int p= 0; p < parameterTypeCvs.length; p++) { if (parameterTypeCvs[p] == null) continue; ParameterTypeVariable2 parameterTypeCv= fTCModel.makeParameterTypeVariable(superMethod, p); fTCModel.createElementEqualsConstraints(parameterTypeCv, parameterTypeCvs[p]); } if (returnTypeCv != null) { ReturnTypeVariable2 superMethodReturnTypeCv= fTCModel.makeReturnTypeVariable(superMethod); fTCModel.createElementEqualsConstraints(superMethodReturnTypeCv, returnTypeCv); } } }
private void addConstraintsForOverriding(IMethodBinding methodBinding, ConstraintVariable2 returnTypeCv, ConstraintVariable2[] parameterTypeCvs) { boolean hasParameterElementCvs= false; for (int i= 0; i < parameterTypeCvs.length; i++) if (parameterTypeCvs[i] != null) hasParameterElementCvs= true; if (returnTypeCv == null && ! hasParameterElementCvs) return; ITypeBinding[] allSuperTypes= Bindings.getAllSuperTypes(methodBinding.getDeclaringClass()); for (int i= 0; i < allSuperTypes.length; i++) { ITypeBinding superType= allSuperTypes[i]; IMethodBinding superMethod= Bindings.findOverriddenMethodInType(superType, methodBinding); if (superMethod == null) continue; for (int p= 0; p < parameterTypeCvs.length; p++) { if (parameterTypeCvs[p] == null) continue; ParameterTypeVariable2 parameterTypeCv= fTCModel.makeParameterTypeVariable(superMethod, p); fTCModel.createElementEqualsConstraints(parameterTypeCv, parameterTypeCvs[p]); } if (returnTypeCv != null) { ReturnTypeVariable2 superMethodReturnTypeCv= fTCModel.makeReturnTypeVariable(superMethod); fTCModel.createElementEqualsConstraints(superMethodReturnTypeCv, returnTypeCv); } } }
private void addConstraintsForOverriding(IMethodBinding methodBinding, ConstraintVariable2 returnTypeCv, ConstraintVariable2[] parameterTypeCvs) { boolean hasParameterElementCvs= false; for (int i= 0; i < parameterTypeCvs.length; i++) if (parameterTypeCvs[i] != null) hasParameterElementCvs= true; if (returnTypeCv == null && ! hasParameterElementCvs) return; ITypeBinding[] allSuperTypes= Bindings.getAllSuperTypes(methodBinding.getDeclaringClass()); for (int i= 0; i < allSuperTypes.length; i++) { ITypeBinding superType= allSuperTypes[i]; IMethodBinding superMethod= Bindings.findOverriddenMethodInType(superType, methodBinding); if (superMethod == null) continue; for (int p= 0; p < parameterTypeCvs.length; p++) { if (parameterTypeCvs[p] == null) continue; ParameterTypeVariable2 parameterTypeCv= fTCModel.makeParameterTypeVariable(superMethod, p); fTCModel.createElementEqualsConstraints(parameterTypeCv, parameterTypeCvs[p]); } if (returnTypeCv != null) { ReturnTypeVariable2 superMethodReturnTypeCv= fTCModel.makeReturnTypeVariable(superMethod); fTCModel.createElementEqualsConstraints(superMethodReturnTypeCv, returnTypeCv); } } }
for (int i= 0; i < superTypes.length; i++) { ITypeBinding curr= superTypes[i]; if (curr.isFromSource() && Bindings.findOverriddenMethodInType(curr, binding) == null) { return true; ITypeBinding curr= superTypes[i]; if (curr.isFromSource()) { IMethodBinding method= Bindings.findOverriddenMethodInType(curr, binding); if (method == null) { ITypeBinding typeDecl= curr.getTypeDeclaration();
for (int i= 0; i < superTypes.length; i++) { ITypeBinding curr= superTypes[i]; if (curr.isFromSource() && Bindings.findOverriddenMethodInType(curr, binding) == null) { return true; ITypeBinding curr= superTypes[i]; if (curr.isFromSource()) { IMethodBinding method= Bindings.findOverriddenMethodInType(curr, binding); if (method == null) { ITypeBinding typeDecl= curr.getTypeDeclaration();
for (int i= 0; i < superTypes.length; i++) { ITypeBinding curr= superTypes[i]; if (curr.isFromSource() && Bindings.findOverriddenMethodInType(curr, binding) == null) { return true; ITypeBinding curr= superTypes[i]; if (curr.isFromSource()) { IMethodBinding method= Bindings.findOverriddenMethodInType(curr, binding); if (method == null) { ITypeBinding typeDecl= curr.getTypeDeclaration();
while (overriddenInClass == null && curr.getSuperclass() != null) { curr= curr.getSuperclass(); overriddenInClass= Bindings.findOverriddenMethodInType(curr, method);
while (overriddenInClass == null && curr.getSuperclass() != null) { curr= curr.getSuperclass(); overriddenInClass= Bindings.findOverriddenMethodInType(curr, method);