public OverrideMethodComparator(ITypeBinding curr) { if (curr != null) { ITypeBinding[] superTypes= Bindings.getAllSuperTypes(curr); fAllTypes= new ITypeBinding[superTypes.length + 1]; fAllTypes[0]= curr; System.arraycopy(superTypes, 0, fAllTypes, 1, superTypes.length); } }
public OverrideMethodComparator(ITypeBinding curr) { if (curr != null) { ITypeBinding[] superTypes= Bindings.getAllSuperTypes(curr); fAllTypes= new ITypeBinding[superTypes.length + 1]; fAllTypes[0]= curr; System.arraycopy(superTypes, 0, fAllTypes, 1, superTypes.length); } }
public OverrideMethodComparator(ITypeBinding curr) { if (curr != null) { ITypeBinding[] superTypes= Bindings.getAllSuperTypes(curr); fAllTypes= new ITypeBinding[superTypes.length + 1]; fAllTypes[0]= curr; System.arraycopy(superTypes, 0, fAllTypes, 1, superTypes.length); } }
private static Set<ITypeBinding> getDeclaringSuperTypes(IMethodBinding methodBinding) { ITypeBinding[] allSuperTypes= Bindings.getAllSuperTypes(methodBinding.getDeclaringClass()); Set<ITypeBinding> result= new HashSet<>(); for (int i= 0; i < allSuperTypes.length; i++) { ITypeBinding type= allSuperTypes[i]; if (findMethod(methodBinding, type) != null) result.add(type); } return result; }
private static Set<ITypeBinding> getDeclaringSuperTypes(IVariableBinding fieldBinding) { ITypeBinding[] allSuperTypes= Bindings.getAllSuperTypes(fieldBinding.getDeclaringClass()); Set<ITypeBinding> result= new HashSet<>(); for (int i= 0; i < allSuperTypes.length; i++) { ITypeBinding type= allSuperTypes[i]; if (findField(fieldBinding, type) != null) result.add(type); } return result; }
private static Set getDeclaringSuperTypes(IMethodBinding methodBinding) { ITypeBinding[] allSuperTypes= Bindings.getAllSuperTypes(methodBinding.getDeclaringClass()); Set result= new HashSet(); for (int i= 0; i < allSuperTypes.length; i++) { ITypeBinding type= allSuperTypes[i]; if (findMethod(methodBinding, type) != null) result.add(type); } return result; }
protected static Set<ITypeBinding> getDeclaringSuperTypes(IMethodBinding methodBinding) { ITypeBinding superClass = methodBinding.getDeclaringClass(); Set<ITypeBinding> allSuperTypes= new LinkedHashSet<>(); allSuperTypes.addAll(Arrays.asList(Bindings.getAllSuperTypes(superClass))); if (allSuperTypes.isEmpty()) allSuperTypes.add(methodBinding.getDeclaringClass()); //TODO: Why only iff empty? The declaring class is not a supertype ... Set<ITypeBinding> result= new HashSet<>(); for (Iterator<ITypeBinding> iter= allSuperTypes.iterator(); iter.hasNext();) { ITypeBinding type= iter.next(); if (findMethod(methodBinding, type) != null) result.add(type); } return result; }
private static Set<ITypeBinding> getDeclaringSuperTypes(IVariableBinding fieldBinding) { ITypeBinding[] allSuperTypes= Bindings.getAllSuperTypes(fieldBinding.getDeclaringClass()); Set<ITypeBinding> result= new HashSet<>(); for (int i= 0; i < allSuperTypes.length; i++) { ITypeBinding type= allSuperTypes[i]; if (findField(fieldBinding, type) != null) result.add(type); } return result; }
protected static Set<ITypeBinding> getDeclaringSuperTypes(IMethodBinding methodBinding) { ITypeBinding superClass = methodBinding.getDeclaringClass(); Set<ITypeBinding> allSuperTypes= new LinkedHashSet<>(); allSuperTypes.addAll(Arrays.asList(Bindings.getAllSuperTypes(superClass))); if (allSuperTypes.isEmpty()) allSuperTypes.add(methodBinding.getDeclaringClass()); //TODO: Why only iff empty? The declaring class is not a supertype ... Set<ITypeBinding> result= new HashSet<>(); for (Iterator<ITypeBinding> iter= allSuperTypes.iterator(); iter.hasNext();) { ITypeBinding type= iter.next(); if (findMethod(methodBinding, type) != null) result.add(type); } return result; }
private static Set getDeclaringSuperTypes(IVariableBinding fieldBinding) { ITypeBinding[] allSuperTypes= Bindings.getAllSuperTypes(fieldBinding.getDeclaringClass()); Set result= new HashSet(); for (int i= 0; i < allSuperTypes.length; i++) { ITypeBinding type= allSuperTypes[i]; if (findField(fieldBinding, type) != null) result.add(type); } return result; }
private static Set<ITypeBinding> getDeclaringSuperTypes(IMethodBinding methodBinding) { ITypeBinding[] allSuperTypes= Bindings.getAllSuperTypes(methodBinding.getDeclaringClass()); Set<ITypeBinding> result= new HashSet<>(); for (int i= 0; i < allSuperTypes.length; i++) { ITypeBinding type= allSuperTypes[i]; if (findMethod(methodBinding, type) != null) result.add(type); } return result; }
protected static Set getDeclaringSuperTypes(IMethodBinding methodBinding) { ITypeBinding superClass = methodBinding.getDeclaringClass(); Set allSuperTypes= new LinkedHashSet(); allSuperTypes.addAll(Arrays.asList(Bindings.getAllSuperTypes(superClass))); if (allSuperTypes.isEmpty()) allSuperTypes.add(methodBinding.getDeclaringClass()); //TODO: Why only iff empty? The declaring class is not a supertype ... Set result= new HashSet(); for (Iterator iter= allSuperTypes.iterator(); iter.hasNext();) { ITypeBinding type= (ITypeBinding) iter.next(); if (findMethod(methodBinding, type) != null) result.add(type); } return result; }
ITypeBinding[] superTypes = Bindings.getAllSuperTypes(paramType);
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); } } }
public final void acceptAST(final ICompilationUnit unit, final CompilationUnit node) { try { final IType subType= (IType) JavaModelUtil.findInCompilationUnit(unit, declaring); final AbstractTypeDeclaration subDeclaration= ASTNodeSearchUtil.getAbstractTypeDeclarationNode(subType, node); if (subDeclaration != null) { final ITypeBinding subBinding= subDeclaration.resolveBinding(); if (subBinding != null) { String name= null; ITypeBinding superBinding= null; final ITypeBinding[] superBindings= Bindings.getAllSuperTypes(subBinding); for (int index= 0; index < superBindings.length; index++) { name= superBindings[index].getName(); if (name.startsWith(fDestinationType.getElementName())) superBinding= superBindings[index]; } if (superBinding != null) { solveSuperTypeConstraints(unit, node, subType, subBinding, superBinding, new SubProgressMonitor(monitor, 80), status); if (!status.hasFatalError()) rewriteTypeOccurrences(manager, this, sourceRewrite, unit, node, replacements, status, new SubProgressMonitor(monitor, 120)); } } } } catch (JavaModelException exception) { JavaPlugin.log(exception); status.merge(RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ExtractInterfaceProcessor_internal_error)); } }
@Override public final void acceptAST(final ICompilationUnit unit, final CompilationUnit node) { try { final IType subType= (IType) JavaModelUtil.findInCompilationUnit(unit, declaring); final AbstractTypeDeclaration subDeclaration= ASTNodeSearchUtil.getAbstractTypeDeclarationNode(subType, node); if (subDeclaration != null) { final ITypeBinding subBinding= subDeclaration.resolveBinding(); if (subBinding != null) { String name= null; ITypeBinding superBinding= null; final ITypeBinding[] superBindings= Bindings.getAllSuperTypes(subBinding); for (int index= 0; index < superBindings.length; index++) { name= superBindings[index].getName(); if (name.startsWith(fDestinationType.getElementName())) superBinding= superBindings[index]; } if (superBinding != null) { solveSuperTypeConstraints(unit, node, subType, subBinding, superBinding, new SubProgressMonitor(monitor, 80), status); if (!status.hasFatalError()) rewriteTypeOccurrences(manager, this, sourceRewrite, unit, node, replacements, status, new SubProgressMonitor(monitor, 120)); } } } } catch (JavaModelException exception) { JavaPlugin.log(exception); status.merge(RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ExtractInterfaceProcessor_internal_error)); } }
@Override public final void acceptAST(final ICompilationUnit unit, final CompilationUnit node) { try { final IType subType= (IType) JavaModelUtil.findInCompilationUnit(unit, declaring); final AbstractTypeDeclaration subDeclaration= ASTNodeSearchUtil.getAbstractTypeDeclarationNode(subType, node); if (subDeclaration != null) { final ITypeBinding subBinding= subDeclaration.resolveBinding(); if (subBinding != null) { String name= null; ITypeBinding superBinding= null; final ITypeBinding[] superBindings= Bindings.getAllSuperTypes(subBinding); for (int index= 0; index < superBindings.length; index++) { name= superBindings[index].getName(); if (name.startsWith(fDestinationType.getElementName())) superBinding= superBindings[index]; } if (superBinding != null) { solveSuperTypeConstraints(unit, node, subType, subBinding, superBinding, new SubProgressMonitor(monitor, 80), status); if (!status.hasFatalError()) rewriteTypeOccurrences(manager, this, sourceRewrite, unit, node, replacements, status, new SubProgressMonitor(monitor, 120)); } } } } catch (JavaModelException exception) { JavaPlugin.log(exception); status.merge(RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ExtractInterfaceProcessor_internal_error)); } }
ITypeBinding[] paramTypes= binding.getParameterTypes(); ITypeBinding[] superTypes= Bindings.getAllSuperTypes(binding.getDeclaringClass()); if (resultingCollections == null) { for (int i= 0; i < superTypes.length; i++) {