Lines 2133-2137
Link Here
|
2133 |
element |
2133 |
element |
2134 |
); |
2134 |
); |
2135 |
} |
2135 |
} |
|
|
2136 |
/** |
2137 |
* Test behavior when the binding key denotes a non existent type. |
2138 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=157847" |
2139 |
*/ |
2140 |
public void test157847a() throws CoreException { |
2141 |
String filePath = "/P/src/Bug157847A.java"; |
2142 |
try { |
2143 |
String contents = |
2144 |
"public class Bug157847A<T> {\n" + |
2145 |
" void add(Y<? extends T> l) {}\n" + |
2146 |
"}\n"+ |
2147 |
"interface Y<T> {}\n"; |
2148 |
createFile(filePath, contents); |
2149 |
|
2150 |
BindingRequestor requestor = new BindingRequestor(); |
2151 |
String[] bindingKeys = new String[] {"LBug157847A~ThisTypeDoesNotExist;"}; |
2152 |
resolveASTs( |
2153 |
new ICompilationUnit[] {}, |
2154 |
bindingKeys, |
2155 |
requestor, |
2156 |
getJavaProject("P"), |
2157 |
this.workingCopy.getOwner() |
2158 |
); |
2159 |
IBinding[] bindings = requestor.getBindings(bindingKeys); |
2160 |
assertTrue("Constructed non existing type", bindings.length == 0); |
2161 |
} finally { |
2162 |
deleteFile(filePath); |
2163 |
} |
2164 |
} |
2165 |
/** |
2166 |
* Ensures that we don't create internally inconsistent wildcard |
2167 |
* bindings of the form '? extends <null>' or '? super <null>' |
2168 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=157847" |
2169 |
*/ |
2170 |
public void test157847b() throws CoreException { |
2171 |
String filePath = "/P/src/Bug157847B.java"; |
2172 |
try { |
2173 |
String contents = |
2174 |
"public class Bug157847B<T> {\n" + |
2175 |
" void add(Y<? super T> l) {}\n" + |
2176 |
"}\n"+ |
2177 |
"interface Y<T> {}\n"; |
2178 |
createFile(filePath, contents); |
2179 |
|
2180 |
BindingRequestor requestor = new BindingRequestor(); |
2181 |
String[] bindingKeys = new String[] {"LBug157847B~Y<LBug157847B~Y;{0}-!LBug157847B;{0}*54;>;"}; |
2182 |
resolveASTs( |
2183 |
new ICompilationUnit[] {}, |
2184 |
bindingKeys, |
2185 |
requestor, |
2186 |
getJavaProject("P"), |
2187 |
this.workingCopy.getOwner() |
2188 |
); |
2189 |
IBinding[] bindings = requestor.getBindings(bindingKeys); |
2190 |
assertTrue("Constructed bogus wildcard", bindings.length == 0); |
2191 |
} finally { |
2192 |
deleteFile(filePath); |
2193 |
} |
2194 |
} |
2195 |
/** |
2196 |
* Ensures that we don't create internally inconsistent wildcard |
2197 |
* bindings of the form '? extends <null>' or '? super <null>' |
2198 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=157847" |
2199 |
*/ |
2200 |
public void test157847c() throws CoreException { |
2201 |
String filePath = "/P/src/Bug157847C.java"; |
2202 |
try { |
2203 |
String contents = |
2204 |
"public class Bug157847C<T> {\n" + |
2205 |
" void add(Y<? extends T> l) {}\n" + |
2206 |
"}\n"+ |
2207 |
"interface Y<T> {}\n"; |
2208 |
createFile(filePath, contents); |
2209 |
|
2210 |
BindingRequestor requestor = new BindingRequestor(); |
2211 |
String[] bindingKeys = new String[] {"LBug157847C~Y<LBug157847C~Y;{0}+!LBug157847C;{0}*54;>;"}; |
2212 |
resolveASTs( |
2213 |
new ICompilationUnit[] {}, |
2214 |
bindingKeys, |
2215 |
requestor, |
2216 |
getJavaProject("P"), |
2217 |
this.workingCopy.getOwner() |
2218 |
); |
2219 |
IBinding[] bindings = requestor.getBindings(bindingKeys); |
2220 |
assertTrue("Constructed bogus wildcard", bindings.length == 0); |
2221 |
} finally { |
2222 |
deleteFile(filePath); |
2223 |
} |
2224 |
} |
2136 |
|
2225 |
|
2137 |
} |
2226 |
} |