if (type.isPrimitive() || type.isAnonymous() || type.isNullType()) return null; if (type.isArray()) return findType(type.getElementType(), scope);    String[] typeElements= Bindings.getNameComponents(type); IJavaElement element= scope.findElement(getPathToCompilationUnit(type.getPackage(), typeElements[0])); IType candidate= null; if (element instanceof ICompilationUnit) { candidate= ((ICompilationUnit)element).getType(typeElements[0]); } else if (element instanceof IClassFile) { candidate= ((IClassFile)element).getType(); } else if (element == null) { if (type.isMember()) candidate= JavaModelUtil.findType(scope, Bindings.getFullyQualifiedName(type.getDeclaringClass())); else candidate= JavaModelUtil.findType(scope, Bindings.getFullyQualifiedName(type));
IType originalFindType= originalFindType(type, scope); if (CHECK_CORE_BINDING_GET_JAVA_ELEMENT) { IType iType= (IType) type.getJavaElement(); if (iType != null && ! iType.equals(originalFindType) || iType == null && originalFindType != null) { JavaPlugin.logRepeatedMessage("ITypeBinding#getJavaElement() is not correct element", "type == " + type.getKey() + ", project == " + scope.getElementName() + ", iType == " + iType + ", originalFindType == " + originalFindType); }
	public static IType findType(ITypeBinding type, IJavaProject scope) throws JavaModelException {		if (type.isPrimitive() || type.isAnonymous() || type.isNullType())			return null;		if (type.isArray())			return findType(type.getElementType(), scope);					// TODO: JavaCore should allow to find secondary top level types.				String[] typeElements= Bindings.getNameComponents(type);		IJavaElement element= scope.findElement(getPathToCompilationUnit(type.getPackage(), typeElements[0]));		IType candidate= null;		if (element instanceof ICompilationUnit) {			candidate= ((ICompilationUnit)element).getType(typeElements[0]);		} else if (element instanceof IClassFile) {			candidate= ((IClassFile)element).getType();		} else if (element == null) {			if (type.isMember())				candidate= JavaModelUtil.findType(scope, Bindings.getFullyQualifiedName(type.getDeclaringClass()));			else				candidate= JavaModelUtil.findType(scope, Bindings.getFullyQualifiedName(type));		}				if (candidate == null || typeElements.length == 1)			return candidate;					return findTypeInType(typeElements, candidate);	}