Lines 19-24
Link Here
|
19 |
import org.eclipse.jdt.core.IClassFile; |
19 |
import org.eclipse.jdt.core.IClassFile; |
20 |
import org.eclipse.jdt.core.ICompilationUnit; |
20 |
import org.eclipse.jdt.core.ICompilationUnit; |
21 |
import org.eclipse.jdt.core.IJavaProject; |
21 |
import org.eclipse.jdt.core.IJavaProject; |
|
|
22 |
import org.eclipse.jdt.core.JavaModelException; |
22 |
import org.eclipse.jdt.core.WorkingCopyOwner; |
23 |
import org.eclipse.jdt.core.WorkingCopyOwner; |
23 |
import org.eclipse.jdt.core.dom.*; |
24 |
import org.eclipse.jdt.core.dom.*; |
24 |
|
25 |
|
Lines 231-236
Link Here
|
231 |
} |
232 |
} |
232 |
|
233 |
|
233 |
/** |
234 |
/** |
|
|
235 |
* @bug 212100: [dom] Can't create binding to inner class |
236 |
* @test Verify that the binding is well created for an inner class |
237 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=212100" |
238 |
*/ |
239 |
public void testBug212100a() throws JavaModelException { |
240 |
workingCopies = new ICompilationUnit[1]; |
241 |
this.workingCopies[0] = getWorkingCopy("/Converter15/src/X.java", true/*resolve*/); |
242 |
String contents = |
243 |
"public class X {\n" + |
244 |
" public class Y {\n" + |
245 |
" void foo() {}\n" + |
246 |
" }\n" + |
247 |
"}"; |
248 |
this.workingCopies[0].getBuffer().setContents(contents); |
249 |
this.workingCopies[0].save(null, true); |
250 |
final IBinding[] bindings = new IBinding[4]; |
251 |
final String key = "Ljava/lang/Object;"; // this will make the test fail |
252 |
// final String key = "LX;"; // this would make the test pass |
253 |
|
254 |
resolveASTs(this.workingCopies, |
255 |
new String[] { key }, |
256 |
new ASTRequestor() { |
257 |
public void acceptBinding(String bindingKey, IBinding binding) { |
258 |
if (key.equals(bindingKey)) { |
259 |
bindings[0] = binding; |
260 |
IBinding[] temp = createBindings(new String[] {"LX;", "LX$Y;", "[LX$Y;"}); |
261 |
for (int i = 0; i < temp.length; ++i) { |
262 |
bindings[i + 1] = temp[i]; |
263 |
} |
264 |
} |
265 |
} |
266 |
}, |
267 |
getJavaProject("Converter15"), |
268 |
null); |
269 |
assertNotNull("Binding for java.lang.Object should not be null", bindings[0]); |
270 |
assertNotNull("Binding for X should not be null", bindings[1]); |
271 |
assertNotNull("Binding for X.Y should not be null", bindings[2]); |
272 |
assertNotNull("Binding for X.Y[] should not be null", bindings[3]); |
273 |
} |
274 |
public void testBug212100b() throws JavaModelException { |
275 |
this.workingCopies = new ICompilationUnit[2]; |
276 |
this.workingCopies[0] = getWorkingCopy("/Converter15/src/X.java", true/*resolve*/); |
277 |
String contents = |
278 |
"public class X {\n" + |
279 |
" public class Y {\n" + |
280 |
" void foo() {}\n" + |
281 |
" }\n" + |
282 |
"}"; |
283 |
this.workingCopies[0].getBuffer().setContents(contents); |
284 |
this.workingCopies[0].save(null, true); |
285 |
|
286 |
this.workingCopies[1] = getWorkingCopy("/Converter15/src/Z.java", true/*resolve*/); |
287 |
String contentsZ = |
288 |
"public class Z {\n" + |
289 |
" public class W {\n" + |
290 |
" void bar() {}\n" + |
291 |
" }\n" + |
292 |
"}"; |
293 |
this.workingCopies[1].getBuffer().setContents(contentsZ); |
294 |
this.workingCopies[1].save(null, true); |
295 |
|
296 |
final String keyX = "LX;"; |
297 |
final String keyXY = "LX$Y;"; |
298 |
final String keyZ = "LZ;"; |
299 |
final String keyZW = "LZ$W;"; |
300 |
|
301 |
resolveASTs(this.workingCopies, |
302 |
new String[] { keyX, keyZ }, |
303 |
new ASTRequestor() { |
304 |
public void acceptBinding(String bindingKey, IBinding binding) { |
305 |
IBinding[] bindings = createBindings(new String[] { |
306 |
keyX, keyXY, keyZ, keyZW |
307 |
}); |
308 |
assertNotNull("When accepting " + bindingKey + ", Binding for X should not be null", bindings[0]); |
309 |
assertNotNull("When accepting " + bindingKey + ", Binding for X.Y should not be null", bindings[1]); |
310 |
assertNotNull("When accepting " + bindingKey + ", Binding for Z should not be null", bindings[2]); |
311 |
assertNotNull("When accepting " + bindingKey + ", Binding for Z.W should not be null", bindings[3]); |
312 |
} |
313 |
}, |
314 |
getJavaProject("Converter15"), |
315 |
null); |
316 |
} |
317 |
|
318 |
/** |
234 |
* @bug 212834: [dom] IMethodBinding.getParameterAnnotations does not return annotations |
319 |
* @bug 212834: [dom] IMethodBinding.getParameterAnnotations does not return annotations |
235 |
* @test Ensures that the method binding get the parameter annotations even on method invocation |
320 |
* @test Ensures that the method binding get the parameter annotations even on method invocation |
236 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=212834" |
321 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=212834" |