List of usage examples for org.eclipse.jdt.internal.compiler.lookup ProblemReferenceBinding problemReasonString
public static String problemReasonString(int problemReason)
From source file:com.google.gwt.dev.javac.ArtificialRescueChecker.java
License:Open Source License
static String unknownProblem(String className, ProblemReferenceBinding problem) { return "Unknown problem: " + ProblemReferenceBinding.problemReasonString(problem.problemId()) + " " + className;//www . j av a 2 s . c o m }
From source file:com.redhat.ceylon.eclipse.core.model.JDTModelLoader.java
License:Open Source License
private static ReferenceBinding toBinding(IType type, LookupEnvironment theLookupEnvironment, char[][] compoundName) throws JavaModelException { ITypeRoot typeRoot = type.getTypeRoot(); if (typeRoot instanceof IClassFile) { ClassFile classFile = (ClassFile) typeRoot; IFile classFileRsrc = (IFile) classFile.getCorrespondingResource(); if (classFileRsrc != null && !classFileRsrc.exists()) { //the .class file has been deleted return null; }/* w w w.j av a 2s .c o m*/ BinaryTypeBinding binaryTypeBinding = null; try { IBinaryType binaryType = classFile.getBinaryTypeInfo(classFileRsrc, true); binaryTypeBinding = theLookupEnvironment.cacheBinaryType(binaryType, null); } catch (JavaModelException e) { if (!e.isDoesNotExist()) { throw e; } } if (binaryTypeBinding == null) { ReferenceBinding existingType = theLookupEnvironment.getCachedType(compoundName); if (existingType == null || !(existingType instanceof BinaryTypeBinding)) { return null; } binaryTypeBinding = (BinaryTypeBinding) existingType; } return binaryTypeBinding; } else { ReferenceBinding referenceBinding = theLookupEnvironment.getType(compoundName); if (referenceBinding != null && !(referenceBinding instanceof BinaryTypeBinding)) { if (referenceBinding instanceof ProblemReferenceBinding) { ProblemReferenceBinding problemReferenceBinding = (ProblemReferenceBinding) referenceBinding; if (problemReferenceBinding.problemId() == ProblemReasons.InternalNameProvided) { referenceBinding = problemReferenceBinding.closestReferenceMatch(); } else { System.out.println( ProblemReferenceBinding.problemReasonString(problemReferenceBinding.problemId())); return null; } } return referenceBinding; } return null; } }
From source file:com.redhat.ceylon.eclipse.core.model.loader.JDTModelLoader.java
License:Open Source License
private ClassMirror buildClassMirror(String name) { try {// www. ja v a 2 s . co m IType type = javaProject.findType(name); if (type == null) { return null; } LookupEnvironment theLookupEnvironment = getLookupEnvironment(); if (type.isBinary()) { ClassFile classFile = (ClassFile) type.getClassFile(); if (classFile != null) { IPackageFragmentRoot fragmentRoot = classFile.getPackageFragmentRoot(); if (fragmentRoot != null) { if (isInCeylonClassesOutputFolder(fragmentRoot.getPath())) { return null; } } IFile classFileRsrc = (IFile) classFile.getCorrespondingResource(); IBinaryType binaryType = classFile.getBinaryTypeInfo(classFileRsrc, true); if (classFileRsrc != null && !classFileRsrc.exists()) { //the .class file has been deleted return null; } BinaryTypeBinding binaryTypeBinding = theLookupEnvironment.cacheBinaryType(binaryType, null); if (binaryTypeBinding == null) { char[][] compoundName = CharOperation.splitOn('/', binaryType.getName()); ReferenceBinding existingType = theLookupEnvironment.getCachedType(compoundName); if (existingType == null || !(existingType instanceof BinaryTypeBinding)) { return null; } binaryTypeBinding = (BinaryTypeBinding) existingType; } return new JDTClass(binaryTypeBinding, theLookupEnvironment); } } else { char[][] compoundName = CharOperation.splitOn('.', type.getFullyQualifiedName().toCharArray()); ReferenceBinding referenceBinding = theLookupEnvironment.getType(compoundName); if (referenceBinding != null) { if (referenceBinding instanceof ProblemReferenceBinding) { ProblemReferenceBinding problemReferenceBinding = (ProblemReferenceBinding) referenceBinding; if (problemReferenceBinding.problemId() == ProblemReasons.InternalNameProvided) { referenceBinding = problemReferenceBinding.closestReferenceMatch(); } else { System.out.println(ProblemReferenceBinding .problemReasonString(problemReferenceBinding.problemId())); return null; } } return new JDTClass(referenceBinding, theLookupEnvironment); } } } catch (JavaModelException e) { e.printStackTrace(); } return null; }