Lines 6806-6811
Link Here
|
6806 |
} |
6806 |
} |
6807 |
|
6807 |
|
6808 |
/** |
6808 |
/** |
|
|
6809 |
* Bug 144044: [search] NPE when trying to find references to field variable |
6810 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=144044" |
6811 |
*/ |
6812 |
public void testBug144044() throws CoreException { |
6813 |
workingCopies = new ICompilationUnit[2]; |
6814 |
workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/test1/p/Test.java", |
6815 |
"package test1.p;\n" + |
6816 |
"import test1.q.X;\n" + |
6817 |
"public class Test {\n" + |
6818 |
" String foo(X val) {\n" + |
6819 |
" return val.str;\n" + |
6820 |
" }\n" + |
6821 |
"}\n" |
6822 |
); |
6823 |
workingCopies[1] = getWorkingCopy("/JavaSearchBugs/src/test1/q/X.java", |
6824 |
"package test1.q;\n" + |
6825 |
"public class X {\n" + |
6826 |
" String str;\n" + |
6827 |
"}\n" |
6828 |
); |
6829 |
IType type = this.workingCopies[1].getType("X"); |
6830 |
IField field = type.getField("str"); |
6831 |
search(field, REFERENCES); |
6832 |
assertSearchResults( |
6833 |
"src/test1/p/Test.java String test1.p.Test.foo(X) [str] POTENTIAL_MATCH" |
6834 |
); |
6835 |
} |
6836 |
public void testBug144044b() throws CoreException { |
6837 |
workingCopies = new ICompilationUnit[4]; |
6838 |
workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/test2/p/Test.java", |
6839 |
"package test2.p;\n" + |
6840 |
"import test2.q.X;\n" + |
6841 |
"public class Test {\n" + |
6842 |
" X foo() {\n" + |
6843 |
" return X.y_field.z_field.x_field.y_field.z_field.x_field;\n" + |
6844 |
" }\n" + |
6845 |
"}\n" |
6846 |
); |
6847 |
workingCopies[1] = getWorkingCopy("/JavaSearchBugs/src/test2/q/X.java", |
6848 |
"package test2.q;\n" + |
6849 |
"public class X {\n" + |
6850 |
" public static Y y_field;\n" + |
6851 |
"}\n" |
6852 |
); |
6853 |
workingCopies[2] = getWorkingCopy("/JavaSearchBugs/src/test2/q/Y.java", |
6854 |
"package test2.q;\n" + |
6855 |
"public class Y {\n" + |
6856 |
" public static Z z_field;\n" + |
6857 |
"}\n" |
6858 |
); |
6859 |
workingCopies[3] = getWorkingCopy("/JavaSearchBugs/src/test2/q/Z.java", |
6860 |
"package test2.q;\n" + |
6861 |
"public class Z {\n" + |
6862 |
" static X x_field;\n" + |
6863 |
"}\n" |
6864 |
); |
6865 |
IType type = this.workingCopies[3].getType("Z"); |
6866 |
IField field = type.getField("x_field"); |
6867 |
search(field, REFERENCES); |
6868 |
assertSearchResults( |
6869 |
"src/test2/p/Test.java X test2.p.Test.foo() [x_field] POTENTIAL_MATCH\n" + |
6870 |
"src/test2/p/Test.java X test2.p.Test.foo() [x_field] POTENTIAL_MATCH" |
6871 |
); |
6872 |
} |
6873 |
|
6874 |
/** |
6809 |
* Bug 148215: [search] correct results are missing in java search |
6875 |
* Bug 148215: [search] correct results are missing in java search |
6810 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=148215" |
6876 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=148215" |
6811 |
*/ |
6877 |
*/ |