Lines 11029-11032
Link Here
|
11029 |
deleteProject("P"); |
11029 |
deleteProject("P"); |
11030 |
} |
11030 |
} |
11031 |
} |
11031 |
} |
|
|
11032 |
|
11033 |
static { TESTS_PREFIX = "testBug295894"; } |
11034 |
/** |
11035 |
* @bug 295894: SourceField.getConstant does not supply a value if type is fully qualified |
11036 |
* @test Ensure that source field constant is not null when fully qualified type String is used |
11037 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=295894" |
11038 |
*/ |
11039 |
public void testBug295894() throws Exception { |
11040 |
this.workingCopies = new ICompilationUnit[1]; |
11041 |
this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java", |
11042 |
"public class Test {\n" + |
11043 |
" void test() {\n" + |
11044 |
" Test t = new Test();\n" + |
11045 |
" t.foo();\n" + |
11046 |
" }\n" + |
11047 |
" public void foo() {\n" + |
11048 |
" }\n" + |
11049 |
" public class Sub extends Test {\n" + |
11050 |
" public void foo() {}\n" + |
11051 |
" }\n" + |
11052 |
"}\n" + |
11053 |
"" |
11054 |
); |
11055 |
search( |
11056 |
"foo", |
11057 |
METHOD, |
11058 |
DECLARATIONS, |
11059 |
SearchEngine.createHierarchyScope(this.workingCopies[0].findPrimaryType()), |
11060 |
this.resultCollector); |
11061 |
assertSearchResults( |
11062 |
"src/Test.java void Test.foo() [foo] EXACT_MATCH\n" + |
11063 |
"src/Test.java void Test$Sub.foo() [foo] EXACT_MATCH" |
11064 |
); |
11065 |
} |
11066 |
public void testBug295894a() throws Exception { |
11067 |
this.workingCopies = new ICompilationUnit[1]; |
11068 |
this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java", |
11069 |
"public class Test {\n" + |
11070 |
" void test() {\n" + |
11071 |
" Test t = new Test();\n" + |
11072 |
" t.foo();\n" + |
11073 |
" }\n" + |
11074 |
" public void foo() {\n" + |
11075 |
" }\n" + |
11076 |
" public class Sub extends Test {\n" + |
11077 |
" public void foo() {}\n" + |
11078 |
" }\n" + |
11079 |
"}\n" + |
11080 |
"" |
11081 |
); |
11082 |
search( |
11083 |
"foo", |
11084 |
METHOD, |
11085 |
DECLARATIONS, |
11086 |
SearchEngine.createHierarchyScope(null, this.workingCopies[0].findPrimaryType(), true, true, null), |
11087 |
this.resultCollector); |
11088 |
// No results expected as only sub-types and no member types are set... |
11089 |
assertSearchResults( |
11090 |
"" |
11091 |
); |
11092 |
} |
11093 |
public void testBug295894b() throws Exception { |
11094 |
this.workingCopies = new ICompilationUnit[1]; |
11095 |
this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java", |
11096 |
"public class Test {\n" + |
11097 |
" void test() {\n" + |
11098 |
" Test t = new Test();\n" + |
11099 |
" t.foo();\n" + |
11100 |
" }\n" + |
11101 |
" public void foo() {\n" + |
11102 |
" }\n" + |
11103 |
" public class Sub extends Test {\n" + |
11104 |
" public void foo() {}\n" + |
11105 |
" }\n" + |
11106 |
"}\n" + |
11107 |
"" |
11108 |
); |
11109 |
search( |
11110 |
"foo", |
11111 |
METHOD, |
11112 |
DECLARATIONS, |
11113 |
SearchEngine.createHierarchyScope(null, this.workingCopies[0].findPrimaryType(), false, false, null), |
11114 |
this.resultCollector); |
11115 |
// Same results as the default |
11116 |
assertSearchResults( |
11117 |
"src/Test.java void Test.foo() [foo] EXACT_MATCH\n" + |
11118 |
"src/Test.java void Test$Sub.foo() [foo] EXACT_MATCH" |
11119 |
); |
11120 |
} |
11121 |
public void testBug295894c() throws Exception { |
11122 |
this.workingCopies = new ICompilationUnit[1]; |
11123 |
this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java", |
11124 |
"public class Test {\n" + |
11125 |
" void test() {\n" + |
11126 |
" Test t = new Test();\n" + |
11127 |
" t.foo();\n" + |
11128 |
" }\n" + |
11129 |
" public void foo() {\n" + |
11130 |
" }\n" + |
11131 |
" public class Sub extends Test {\n" + |
11132 |
" public void foo() {}\n" + |
11133 |
" }\n" + |
11134 |
"}\n" + |
11135 |
"" |
11136 |
); |
11137 |
search( |
11138 |
"foo", |
11139 |
METHOD, |
11140 |
DECLARATIONS, |
11141 |
SearchEngine.createHierarchyScope(null, this.workingCopies[0].findPrimaryType(), false, true, null), |
11142 |
this.resultCollector); |
11143 |
// Results in member types are filtered |
11144 |
assertSearchResults( |
11145 |
"src/Test.java void Test.foo() [foo] EXACT_MATCH" |
11146 |
); |
11147 |
} |
11148 |
public void testBug295894d() throws Exception { |
11149 |
this.workingCopies = new ICompilationUnit[1]; |
11150 |
this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java", |
11151 |
"public class Test {\n" + |
11152 |
" void test() {\n" + |
11153 |
" Test t = new Test();\n" + |
11154 |
" t.foo();\n" + |
11155 |
" }\n" + |
11156 |
" public void foo() {\n" + |
11157 |
" }\n" + |
11158 |
" public class Sub extends Test {\n" + |
11159 |
" public void foo() {}\n" + |
11160 |
" }\n" + |
11161 |
"}\n" + |
11162 |
"" |
11163 |
); |
11164 |
search( |
11165 |
"foo", |
11166 |
METHOD, |
11167 |
DECLARATIONS, |
11168 |
SearchEngine.createHierarchyScope(null, this.workingCopies[0].findPrimaryType(), true, false, null), |
11169 |
this.resultCollector); |
11170 |
// Only results in sub-types are returned |
11171 |
assertSearchResults( |
11172 |
"src/Test.java void Test$Sub.foo() [foo] EXACT_MATCH" |
11173 |
); |
11174 |
} |
11032 |
} |
11175 |
} |