Lines 48-53
Link Here
|
48 |
import org.eclipse.jdt.internal.compiler.lookup.TypeConstants; |
48 |
import org.eclipse.jdt.internal.compiler.lookup.TypeConstants; |
49 |
import org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding; |
49 |
import org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding; |
50 |
import org.eclipse.jdt.internal.compiler.lookup.WildcardBinding; |
50 |
import org.eclipse.jdt.internal.compiler.lookup.WildcardBinding; |
|
|
51 |
import org.eclipse.jdt.internal.compiler.util.SuffixConstants; |
51 |
import org.eclipse.jdt.internal.compiler.util.Util; |
52 |
import org.eclipse.jdt.internal.compiler.util.Util; |
52 |
import org.eclipse.jdt.internal.core.ClassFile; |
53 |
import org.eclipse.jdt.internal.core.ClassFile; |
53 |
import org.eclipse.jdt.internal.core.JavaElement; |
54 |
import org.eclipse.jdt.internal.core.JavaElement; |
Lines 396-408
Link Here
|
396 |
else |
397 |
else |
397 |
referenceBinding = (ReferenceBinding) typeBinding; |
398 |
referenceBinding = (ReferenceBinding) typeBinding; |
398 |
char[] fileName = referenceBinding.getFileName(); |
399 |
char[] fileName = referenceBinding.getFileName(); |
399 |
if (Util.isClassFileName(fileName)) { |
|
|
400 |
ClassFile classFile = (ClassFile) getClassFile(fileName); |
401 |
if (classFile == null) return null; |
402 |
return (JavaElement) classFile.getType(); |
403 |
} |
404 |
if (referenceBinding.isLocalType() || referenceBinding.isAnonymousType()) { |
400 |
if (referenceBinding.isLocalType() || referenceBinding.isAnonymousType()) { |
405 |
// local or anonymous type |
401 |
// local or anonymous type |
|
|
402 |
if (Util.isClassFileName(fileName)) { |
403 |
int lastSlash = CharOperation.lastIndexOf('/', fileName); |
404 |
if (lastSlash == -1) |
405 |
lastSlash = CharOperation.lastIndexOf(File.separatorChar, fileName); |
406 |
if (lastSlash == -1) |
407 |
return null; |
408 |
IPackageFragment pkg = getPackageFragment(fileName, lastSlash); |
409 |
char[] constantPoolName = referenceBinding.constantPoolName(); |
410 |
if (constantPoolName == null) { |
411 |
ClassFile classFile = (ClassFile) getClassFile(fileName); |
412 |
return classFile == null ? null : (JavaElement) classFile.getType(); |
413 |
} |
414 |
lastSlash = CharOperation.lastIndexOf('/', constantPoolName); |
415 |
char[] classFileName = CharOperation.subarray(constantPoolName, lastSlash+1, constantPoolName.length); |
416 |
ClassFile classFile = (ClassFile) pkg.getClassFile(new String(classFileName) + SuffixConstants.SUFFIX_STRING_class); |
417 |
return (JavaElement) classFile.getType(); |
418 |
} |
406 |
ICompilationUnit cu = getCompilationUnit(fileName); |
419 |
ICompilationUnit cu = getCompilationUnit(fileName); |
407 |
if (cu == null) return null; |
420 |
if (cu == null) return null; |
408 |
if (!(this.resolver instanceof DefaultBindingResolver)) return null; |
421 |
if (!(this.resolver instanceof DefaultBindingResolver)) return null; |
Lines 435-440
Link Here
|
435 |
ITypeBinding declaringTypeBinding = getDeclaringClass(); |
448 |
ITypeBinding declaringTypeBinding = getDeclaringClass(); |
436 |
if (declaringTypeBinding == null) { |
449 |
if (declaringTypeBinding == null) { |
437 |
// top level type |
450 |
// top level type |
|
|
451 |
if (Util.isClassFileName(fileName)) { |
452 |
ClassFile classFile = (ClassFile) getClassFile(fileName); |
453 |
if (classFile == null) return null; |
454 |
return (JavaElement) classFile.getType(); |
455 |
} |
438 |
ICompilationUnit cu = getCompilationUnit(fileName); |
456 |
ICompilationUnit cu = getCompilationUnit(fileName); |
439 |
if (cu == null) return null; |
457 |
if (cu == null) return null; |
440 |
return (JavaElement) cu.getType(new String(referenceBinding.sourceName())); |
458 |
return (JavaElement) cu.getType(new String(referenceBinding.sourceName())); |