diff options
Diffstat (limited to 'org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java')
-rw-r--r-- | org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java index 48094d331..1630f54f9 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java @@ -294,11 +294,11 @@ private static HashMap workingCopiesThatCanSeeFocus(org.eclipse.jdt.core.ICompil return result; } -public static ClassFileReader classFileReader(IType type) { +public static IBinaryType classFileReader(IType type) { IClassFile classFile = type.getClassFile(); JavaModelManager manager = JavaModelManager.getJavaModelManager(); if (classFile.isOpen()) - return (ClassFileReader) manager.getInfo(type); + return (IBinaryType)manager.getInfo(type); PackageFragment pkg = (PackageFragment) type.getPackageFragment(); IPackageFragmentRoot root = (IPackageFragmentRoot) pkg.getParent(); @@ -549,7 +549,7 @@ protected IJavaElement createHandle(AbstractMethodDeclaration method, IJavaEleme if (type.isBinary()) { // don't cache the methods of the binary type // fall thru if its a constructor with a synthetic argument... find it the slower way - ClassFileReader reader = classFileReader(type); + IBinaryType reader = classFileReader(type); if (reader != null) { // build arguments names boolean firstIsSynthetic = false; @@ -619,7 +619,7 @@ protected IJavaElement createHandle(AbstractMethodDeclaration method, IJavaEleme * Create binary method handle */ IMethod createBinaryMethodHandle(IType type, char[] methodSelector, char[][] argumentTypeNames) { - ClassFileReader reader = MatchLocator.classFileReader(type); + IBinaryType reader = MatchLocator.classFileReader(type); if (reader != null) { IBinaryMethod[] methods = reader.getMethods(); if (methods != null) { @@ -1271,9 +1271,15 @@ public void initialize(JavaProject project, int possibleMatchSize) throws JavaMo SearchableEnvironment searchableEnvironment = project.newSearchableNameEnvironment(this.workingCopies); - this.nameEnvironment = new JavaSearchNameEnvironment(project, this.workingCopies); - if (this.pattern.focus != null) - ((JavaSearchNameEnvironment) this.nameEnvironment).addProjectClassPath((JavaProject) this.pattern.focus.getJavaProject()); + List<IJavaProject> projects = new ArrayList<>(); + projects.add(project); + if (this.pattern.focus != null) { + IJavaProject focusProject = this.pattern.focus.getJavaProject(); + if (focusProject != project) { + projects.add(focusProject); + } + } + this.nameEnvironment = IndexBasedJavaSearchEnvironment.create(projects, this.workingCopies); // create lookup environment Map map = project.getOptions(true); |