Java Code Examples for org.eclipse.jdt.internal.corext.dom.Bindings#getAllSuperTypes()

The following examples show how to use org.eclipse.jdt.internal.corext.dom.Bindings#getAllSuperTypes() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ChangeTypeRefactoring.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private static Set<ITypeBinding> getDeclaringSuperTypes(IMethodBinding methodBinding) {
	ITypeBinding[] allSuperTypes= Bindings.getAllSuperTypes(methodBinding.getDeclaringClass());
	Set<ITypeBinding> result= new HashSet<ITypeBinding>();
	for (int i= 0; i < allSuperTypes.length; i++) {
		ITypeBinding type= allSuperTypes[i];
		if (findMethod(methodBinding, type) != null)
			result.add(type);
	}
	return result;
}
 
Example 2
Source File: InferTypeArgumentsConstraintCreator.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
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);
		}
	}
}
 
Example 3
Source File: FullConstraintCreator.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private static Set<ITypeBinding> getDeclaringSuperTypes(IVariableBinding fieldBinding) {
	ITypeBinding[] allSuperTypes= Bindings.getAllSuperTypes(fieldBinding.getDeclaringClass());
	Set<ITypeBinding> result= new HashSet<ITypeBinding>();
	for (int i= 0; i < allSuperTypes.length; i++) {
		ITypeBinding type= allSuperTypes[i];
		if (findField(fieldBinding, type) != null)
			result.add(type);
	}
	return result;
}
 
Example 4
Source File: OverrideMethodDialog.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
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);
	}
}