Lines 2133-2137
Link Here
|
2133 |
element |
2133 |
element |
2134 |
); |
2134 |
); |
2135 |
} |
2135 |
} |
|
|
2136 |
/** |
2137 |
* Ensures that we don't create internally inconsistent wildcard |
2138 |
* bindings of the form '? extends <null>' or '? super <null>' |
2139 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=157847" |
2140 |
*/ |
2141 |
public void testWildcard2() throws CoreException { |
2142 |
String filePath = "/P/src/Bug157847.java"; |
2143 |
try { |
2144 |
String contents = |
2145 |
"public class Bug157847<T> {\n" + |
2146 |
" void add(Y<? super T> l) {}\n" + |
2147 |
"}\n"+ |
2148 |
"interface Y<T> {}\n"; |
2149 |
createFile(filePath, contents); |
2150 |
|
2151 |
BindingRequestor requestor = new BindingRequestor(); |
2152 |
String[] bindingKeys = new String[] {"LBug157847~Y<LBug157847~Y;{0}-!LBug157847;{0}*54;>;"}; |
2153 |
resolveASTs( |
2154 |
new ICompilationUnit[] {}, |
2155 |
bindingKeys, |
2156 |
requestor, |
2157 |
getJavaProject("P"), |
2158 |
this.workingCopy.getOwner() |
2159 |
); |
2160 |
IBinding[] bindings = requestor.getBindings(bindingKeys); |
2161 |
assertTrue("Constructed bogus wildcard", bindings.length == 0); |
2162 |
} finally { |
2163 |
deleteFile(filePath); |
2164 |
} |
2165 |
} |
2166 |
/** |
2167 |
* Ensures that we don't create internally inconsistent wildcard |
2168 |
* bindings of the form '? extends <null>' or '? super <null>' |
2169 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=157847" |
2170 |
*/ |
2171 |
public void testWildcard3() throws CoreException { |
2172 |
String filePath = "/P/src/Bug157847B.java"; |
2173 |
try { |
2174 |
String contents = |
2175 |
"public class Bug157847B<T> {\n" + |
2176 |
" void add(Y<? extends T> l) {}\n" + |
2177 |
"}\n"+ |
2178 |
"interface Y<T> {}\n"; |
2179 |
createFile(filePath, contents); |
2180 |
|
2181 |
BindingRequestor requestor = new BindingRequestor(); |
2182 |
String[] bindingKeys = new String[] {"LBug157847B~Y<LBug157847B~Y;{0}+!LBug157847B;{0}*54;>;"}; |
2183 |
resolveASTs( |
2184 |
new ICompilationUnit[] {}, |
2185 |
bindingKeys, |
2186 |
requestor, |
2187 |
getJavaProject("P"), |
2188 |
this.workingCopy.getOwner() |
2189 |
); |
2190 |
IBinding[] bindings = requestor.getBindings(bindingKeys); |
2191 |
assertTrue("Constructed bogus wildcard", bindings.length == 0); |
2192 |
} finally { |
2193 |
deleteFile(filePath); |
2194 |
} |
2195 |
} |
2136 |
|
2196 |
|
2137 |
} |
2197 |
} |