Java Code Examples for org.eclipse.jdt.core.dom.SimpleName#resolveTypeBinding()

The following examples show how to use org.eclipse.jdt.core.dom.SimpleName#resolveTypeBinding() . 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
@Override
public boolean match(SimpleName node, Object other) {
	boolean isomorphic = super.match(node, other);
	if (!isomorphic || !(other instanceof SimpleName)) {
		return false;
	}
	SimpleName name = (SimpleName) other;
	IBinding nodeBinding = node.resolveBinding();
	IBinding otherBinding = name.resolveBinding();
	if (nodeBinding == null) {
		if (otherBinding != null) {
			return false;
		}
	} else {
		if (nodeBinding != otherBinding) {
			return false;
		}
	}
	if (node.resolveTypeBinding() != name.resolveTypeBinding()) {
		return false;
	}
	return true;
}
 
Example 2
@Override
public final boolean visit(final SimpleName node) {
	final ITypeBinding binding= node.resolveTypeBinding();
	if (binding != null && binding.isTypeVariable()) {
		String name= null;
		for (int index= 0; index < fMapping.length; index++) {
			name= binding.getName();
			if (fMapping[index].getSourceName().equals(name) && node.getIdentifier().equals(name)) {
				final MethodDeclaration declaration= (MethodDeclaration) ASTNodes.getParent(node, MethodDeclaration.class);
				if (declaration != null) {
					final IMethodBinding method= declaration.resolveBinding();
					if (method != null) {
						final ITypeBinding[] bindings= method.getTypeParameters();
						for (int offset= 0; offset < bindings.length; offset++) {
							if (bindings[offset].isEqualTo(binding))
								return true;
						}
					}
				}
				fRewrite.set(node, SimpleName.IDENTIFIER_PROPERTY, fMapping[index].getTargetName(), null);
			}
		}
	}
	return true;
}
 
Example 3
@Override
public boolean match(SimpleName node, Object other) {
	boolean isomorphic= super.match(node, other);
	if (! isomorphic || !(other instanceof SimpleName))
		return false;
	SimpleName name= (SimpleName)other;
	IBinding nodeBinding= node.resolveBinding();
	IBinding otherBinding= name.resolveBinding();
	if (nodeBinding == null) {
		if (otherBinding != null) {
			return false;
		}
	} else {
		if (nodeBinding != otherBinding) {
			return false;
		}
	}
	if (node.resolveTypeBinding() != name.resolveTypeBinding())
		return false;
	return true;
}
 
Example 4
@Override
public boolean visit(SimpleName node) {
	ITypeBinding typeBinding = node.resolveTypeBinding();
	if (typeBinding != null && typeBinding.isLocal()) {
		if (node.isDeclaration()) {
			fLocalDefinitions.add(typeBinding);
		} else if (!fLocalDefinitions.contains(typeBinding)) {
			fLocalReferencesToEnclosing.add(node);
		}
	}
	if (typeBinding != null && typeBinding.isTypeVariable()) {
		if (node.isDeclaration()) {
			fLocalDefinitions.add(typeBinding);
		} else if (!fLocalDefinitions.contains(typeBinding)) {
			if (fMethodTypeVariables.contains(typeBinding)) {
				fLocalReferencesToEnclosing.add(node);
			} else {
				fClassTypeVariablesUsed = true;
			}
		}
	}
	IBinding binding = node.resolveBinding();
	if (binding != null && binding.getKind() == IBinding.VARIABLE && !((IVariableBinding) binding).isField()) {
		if (node.isDeclaration()) {
			fLocalDefinitions.add(binding);
		} else if (!fLocalDefinitions.contains(binding)) {
			fLocalReferencesToEnclosing.add(node);
		}
	}
	return super.visit(node);
}
 
Example 5
@Override
public final boolean visit(final SimpleName node) {
	Assert.isNotNull(node);
	final ITypeBinding binding= node.resolveTypeBinding();
	if (binding != null && binding.isTypeVariable() && !fBindings.containsKey(binding.getKey())) {
		fBindings.put(binding.getKey(), binding);
		fFound.add(binding);
	}
	return true;
}
 
Example 6
@Override
public boolean visit(SimpleName node) {
	ITypeBinding typeBinding= node.resolveTypeBinding();
	if (typeBinding != null && typeBinding.isLocal()) {
		if (node.isDeclaration()) {
			fLocalDefinitions.add(typeBinding);
		} else if (! fLocalDefinitions.contains(typeBinding)) {
			fLocalReferencesToEnclosing.add(node);
		}
	}
	if (typeBinding != null && typeBinding.isTypeVariable()) {
		if (node.isDeclaration()) {
			fLocalDefinitions.add(typeBinding);
		} else if (! fLocalDefinitions.contains(typeBinding)) {
			if (fMethodTypeVariables.contains(typeBinding)) {
				fLocalReferencesToEnclosing.add(node);
			} else {
				fClassTypeVariablesUsed= true;
			}
		}
	}
	IBinding binding= node.resolveBinding();
	if (binding != null && binding.getKind() == IBinding.VARIABLE && ! ((IVariableBinding)binding).isField()) {
		if (node.isDeclaration()) {
			fLocalDefinitions.add(binding);
		} else if (! fLocalDefinitions.contains(binding)) {
			fLocalReferencesToEnclosing.add(node);
		}
	}
	return super.visit(node);
}
 
Example 7
@Override
public boolean visit(SimpleName node) {
	ITypeBinding binding= node.resolveTypeBinding();
	if (binding != null) {
		boolean res= fVisitor.visit(binding);
		if (res) {
			res= Bindings.visitHierarchy(binding, fVisitor);
		}
		if (!res) {
			throw new VisitCancelledException();
		}
	}
	return false;
}