### Eclipse Workspace Patch 1.0 #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.172 diff -u -r1.172 JavaSearchBugsTests.java --- src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java 15 Apr 2009 08:01:48 -0000 1.172 +++ src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java 19 Jun 2009 14:13:32 -0000 @@ -10197,6 +10197,42 @@ } /** + * @bug 221065: [search] Search still finds overridden method + * @test Ensure that correct number of method references are found + * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=221065" + */ +public void testBug221065() throws CoreException { + this.resultCollector.showRule(); + this.workingCopies = new ICompilationUnit[1]; + this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java", + "public class Test {\n" + + " abstract class A {\n" + + " void foo() {}\n" + + " void bar() {\n" + + " foo();\n" + + " }\n" + + " }\n" + + " class B extends A {\n" + + " void foo() {}\n" + + " void bar() {\n" + + " foo();\n" + + " }\n" + + " }\n" + + " class C extends B {\n" + + " void method() {\n" + + " foo();\n" + + " }\n" + + " }\n" + + "}" + ); + IMethod method = this.workingCopies[0].getType("Test").getType("A").getMethod("foo", new String[0]); + search(method, REFERENCES); + assertSearchResults( + "src/Test.java void Test$A.bar() [foo()] EXACT_MATCH" + ); +} + +/** * @bug 222284: [search] ZipException while searching if linked jar doesn't exist any longer * @test Ensure that no exception is raised while searching for a type of the missing jar file * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=222284" #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.88 diff -u -r1.88 MethodLocator.java --- search/org/eclipse/jdt/internal/core/search/matching/MethodLocator.java 7 Mar 2009 00:59:00 -0000 1.88 +++ search/org/eclipse/jdt/internal/core/search/matching/MethodLocator.java 19 Jun 2009 14:13:33 -0000 @@ -49,6 +49,25 @@ protected int fineGrain() { return this.pattern.fineGrain; } + +private MethodBinding getMethodBinding(ReferenceBinding type, TypeBinding[] argumentTypes) { + MethodBinding[] methods = type.getMethods(this.pattern.selector); + MethodBinding method = null; + methodsLoop: for (int i=0, length=methods.length; i