### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: search/org/eclipse/jdt/internal/core/search/matching/MethodLocator.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MethodLocator.java,v retrieving revision 1.89 diff -u -r1.89 MethodLocator.java --- search/org/eclipse/jdt/internal/core/search/matching/MethodLocator.java 19 Jun 2009 14:43:48 -0000 1.89 +++ search/org/eclipse/jdt/internal/core/search/matching/MethodLocator.java 2 Sep 2010 08:46:26 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -616,7 +616,7 @@ int declaringLevel = subType ? resolveLevelAsSubtype(qualifiedPattern, method.declaringClass, null) : resolveLevelForType(qualifiedPattern, method.declaringClass); - return methodLevel > declaringLevel ? declaringLevel : methodLevel; // return the weaker match + return (methodLevel & MATCH_LEVEL_MASK) > (declaringLevel & MATCH_LEVEL_MASK) ? declaringLevel : methodLevel; // return the weaker match } protected int resolveLevel(MessageSend messageSend) { MethodBinding method = messageSend.binding; @@ -666,7 +666,7 @@ } else { declaringLevel = resolveLevelForType(qualifiedPattern, method.declaringClass); } - return methodLevel > declaringLevel ? declaringLevel : methodLevel; // return the weaker match + return (methodLevel & MATCH_LEVEL_MASK) > (declaringLevel & MATCH_LEVEL_MASK) ? declaringLevel : methodLevel; // return the weaker match } /** #P org.eclipse.jdt.core.tests.model Index: src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java,v retrieving revision 1.204 diff -u -r1.204 JavaSearchBugsTests.java --- src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java 25 Aug 2010 11:11:31 -0000 1.204 +++ src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java 2 Sep 2010 08:46:40 -0000 @@ -12071,4 +12071,23 @@ deleteProject("P"); } } + +/** + * @bug 324109: [search] Java search shows incorrect results as accurate matches + * @test search of method declaration off missing types should report potential matches and not accurate. + * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=324109" + */ +public void testBug324109() throws CoreException { + this.workingCopies = new ICompilationUnit[1]; + this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b324109/X.java", + "package b324109;\n" + + "public class X extends A {\n" + + " public void run() {}\n" + + "}" + ); + search("Worker.run()", METHOD, DECLARATIONS); + assertSearchResults( + "src/b324109/X.java void b324109.X.run() [run] POTENTIAL_MATCH" + ); +} } \ No newline at end of file