Lines 15-20
Link Here
|
15 |
|
15 |
|
16 |
import junit.framework.Test; |
16 |
import junit.framework.Test; |
17 |
|
17 |
|
|
|
18 |
import org.eclipse.core.resources.IncrementalProjectBuilder; |
18 |
import org.eclipse.core.runtime.CoreException; |
19 |
import org.eclipse.core.runtime.CoreException; |
19 |
import org.eclipse.core.runtime.IPath; |
20 |
import org.eclipse.core.runtime.IPath; |
20 |
import org.eclipse.core.runtime.Path; |
21 |
import org.eclipse.core.runtime.Path; |
Lines 7858-7861
Link Here
|
7858 |
// Should have same types with these 2 searches |
7859 |
// Should have same types with these 2 searches |
7859 |
assertEquals("Found types sounds not to be correct", requestor.toString(), collector.toString()); |
7860 |
assertEquals("Found types sounds not to be correct", requestor.toString(), collector.toString()); |
7860 |
} |
7861 |
} |
|
|
7862 |
|
7863 |
/** |
7864 |
* @bug 178847 [search] Potential matches found when searching references to IJavaElement#getResource() |
7865 |
* @test Ensure that accurate matches are found |
7866 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=178847" |
7867 |
*/ |
7868 |
public void testBug178847() throws CoreException { |
7869 |
try { |
7870 |
createJavaProject("P1", new String[] {"src" }, "bin"); |
7871 |
createFolder("/P1/src/p"); |
7872 |
createFile( |
7873 |
"/P1/src/p/X.java", |
7874 |
"package p;\n" + |
7875 |
"public class X{\n" + |
7876 |
"}" |
7877 |
); |
7878 |
createFile( |
7879 |
"/P1/src/p/Y.java", |
7880 |
"package p;\n" + |
7881 |
"public class Y extends X {\n" + |
7882 |
" public static void foo() {}\n" + |
7883 |
"}" |
7884 |
); |
7885 |
getProject("P1").build(IncrementalProjectBuilder.FULL_BUILD, null); |
7886 |
deleteFile("/P1/bin/p/X.class"); |
7887 |
createJavaProject("P2", new String[] {""}, new String[] {"JCL_LIB", "/P1/bin"}, ""); |
7888 |
workingCopies = new ICompilationUnit[2]; |
7889 |
workingCopies[0] = getWorkingCopy("/P2/Test1.java", |
7890 |
"public class Test1 {\n" + |
7891 |
" void bar() {\n" + |
7892 |
" p.Y.foo();\n" + |
7893 |
" new p.X();\n" + // cause AbortCompilation here |
7894 |
" }\n" + |
7895 |
"}" |
7896 |
); |
7897 |
workingCopies[1] = getWorkingCopy("/P2/Test2.java", |
7898 |
"public class Test2 {\n" + |
7899 |
" void foo() {}\n" + |
7900 |
" void bar() {\n" + |
7901 |
" foo();\n" + |
7902 |
" }\n" + |
7903 |
"}" |
7904 |
); |
7905 |
IMethod method = workingCopies[1].getType("Test2").getMethod("foo", new String[0]); |
7906 |
search(method, REFERENCES, EXACT_RULE, SearchEngine.createWorkspaceScope(), resultCollector); |
7907 |
assertSearchResults( |
7908 |
"Test2.java void Test2.bar() [foo()] EXACT_MATCH" |
7909 |
); |
7910 |
} finally { |
7911 |
deleteProjects(new String[] {"P1", "P2" }); |
7912 |
} |
7913 |
} |
7914 |
|
7861 |
} |
7915 |
} |