View | Details | Raw Unified | Return to bug 158985
Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java (-1 / +2 lines)
Lines 2949-2955 Link Here
2949
		"java.lang.IllegalMonitorStateException\n" + 
2949
		"java.lang.IllegalMonitorStateException\n" + 
2950
		"java.lang.InterruptedException\n" + 
2950
		"java.lang.InterruptedException\n" + 
2951
		"java.lang.RuntimeException\n" + 
2951
		"java.lang.RuntimeException\n" + 
2952
		"java.lang.annotation.Annotation",
2952
		"java.lang.annotation.Annotation\n" + 
2953
		"java.lang.annotation.Retention",
2953
		requestor);
2954
		requestor);
2954
}
2955
}
2955
public void testBug92264c() throws CoreException {
2956
public void testBug92264c() throws CoreException {
(-)src/org/eclipse/jdt/core/tests/model/CompletionTests_1_5.java (-12 / +1195 lines)
Lines 2111-2117 Link Here
2111
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
2111
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
2112
2112
2113
	assertResults(
2113
	assertResults(
2114
			"QQAnnotation[TYPE_REF]{pkgannotations.QQAnnotation, pkgannotations, Lpkgannotations.QQAnnotation;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}",
2114
			"QQAnnotation[TYPE_REF]{pkgannotations.QQAnnotation, pkgannotations, Lpkgannotations.QQAnnotation;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}",
2115
			requestor.getResults());
2115
			requestor.getResults());
2116
}
2116
}
2117
public void test0076() throws JavaModelException {	
2117
public void test0076() throws JavaModelException {	
Lines 2135-2141 Link Here
2135
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
2135
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
2136
2136
2137
	assertResults(
2137
	assertResults(
2138
			"QQAnnotation[TYPE_REF]{pkgannotations.QQAnnotation, pkgannotations, Lpkgannotations.QQAnnotation;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}",
2138
			"QQAnnotation[TYPE_REF]{pkgannotations.QQAnnotation, pkgannotations, Lpkgannotations.QQAnnotation;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}",
2139
			requestor.getResults());
2139
			requestor.getResults());
2140
}
2140
}
2141
public void test0077() throws JavaModelException {
2141
public void test0077() throws JavaModelException {
Lines 2186-2192 Link Here
2186
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
2186
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
2187
2187
2188
	assertResults(
2188
	assertResults(
2189
			"QQAnnotation[TYPE_REF]{pkgannotations.QQAnnotation, pkgannotations, Lpkgannotations.QQAnnotation;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}",
2189
			"QQAnnotation[TYPE_REF]{pkgannotations.QQAnnotation, pkgannotations, Lpkgannotations.QQAnnotation;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}",
2190
			requestor.getResults());
2190
			requestor.getResults());
2191
}
2191
}
2192
public void test0079() throws JavaModelException {
2192
public void test0079() throws JavaModelException {
Lines 2211-2217 Link Here
2211
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
2211
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
2212
2212
2213
	assertResults(
2213
	assertResults(
2214
			"QQAnnotation[TYPE_REF]{pkgannotations.QQAnnotation, pkgannotations, Lpkgannotations.QQAnnotation;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}",
2214
			"QQAnnotation[TYPE_REF]{pkgannotations.QQAnnotation, pkgannotations, Lpkgannotations.QQAnnotation;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}",
2215
			requestor.getResults());
2215
			requestor.getResults());
2216
}
2216
}
2217
public void test0080() throws JavaModelException {
2217
public void test0080() throws JavaModelException {
Lines 2236-2242 Link Here
2236
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
2236
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
2237
2237
2238
	assertResults(
2238
	assertResults(
2239
			"QQAnnotation[TYPE_REF]{pkgannotations.QQAnnotation, pkgannotations, Lpkgannotations.QQAnnotation;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}",
2239
			"QQAnnotation[TYPE_REF]{pkgannotations.QQAnnotation, pkgannotations, Lpkgannotations.QQAnnotation;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}",
2240
			requestor.getResults());
2240
			requestor.getResults());
2241
}
2241
}
2242
public void test0081() throws JavaModelException {
2242
public void test0081() throws JavaModelException {
Lines 2261-2267 Link Here
2261
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
2261
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
2262
2262
2263
	assertResults(
2263
	assertResults(
2264
			"QQAnnotation[TYPE_REF]{pkgannotations.QQAnnotation, pkgannotations, Lpkgannotations.QQAnnotation;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}",
2264
			"QQAnnotation[TYPE_REF]{pkgannotations.QQAnnotation, pkgannotations, Lpkgannotations.QQAnnotation;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}",
2265
			requestor.getResults());
2265
			requestor.getResults());
2266
}
2266
}
2267
public void test0082() throws JavaModelException {
2267
public void test0082() throws JavaModelException {
Lines 2287-2293 Link Here
2287
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
2287
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
2288
2288
2289
	assertResults(
2289
	assertResults(
2290
			"QQAnnotation[TYPE_REF]{pkgannotations.QQAnnotation, pkgannotations, Lpkgannotations.QQAnnotation;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}",
2290
			"QQAnnotation[TYPE_REF]{pkgannotations.QQAnnotation, pkgannotations, Lpkgannotations.QQAnnotation;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}",
2291
			requestor.getResults());
2291
			requestor.getResults());
2292
}
2292
}
2293
public void test0083() throws JavaModelException {
2293
public void test0083() throws JavaModelException {
Lines 2367-2373 Link Here
2367
	this.wc.codeComplete(cursorLocation, requestor);
2367
	this.wc.codeComplete(cursorLocation, requestor);
2368
2368
2369
	assertResults(
2369
	assertResults(
2370
			"TestAnnotation[TYPE_REF]{TestAnnotation, test0085, Ltest0085.TestAnnotation;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED + R_UNQUALIFIED) + "}",
2370
			"TestAnnotation[TYPE_REF]{TestAnnotation, test0085, Ltest0085.TestAnnotation;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED + R_UNQUALIFIED) + "}",
2371
			requestor.getResults());
2371
			requestor.getResults());
2372
}
2372
}
2373
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=85290
2373
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=85290
Lines 2388-2394 Link Here
2388
	this.wc.codeComplete(cursorLocation, requestor);
2388
	this.wc.codeComplete(cursorLocation, requestor);
2389
2389
2390
	assertResults(
2390
	assertResults(
2391
			"TestAnnotation[TYPE_REF]{TestAnnotation, , LTestAnnotation;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED + R_UNQUALIFIED) + "}",
2391
			"TestAnnotation[TYPE_REF]{TestAnnotation, , LTestAnnotation;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED + R_UNQUALIFIED) + "}",
2392
			requestor.getResults());
2392
			requestor.getResults());
2393
}
2393
}
2394
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=85402
2394
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=85402
Lines 2415-2421 Link Here
2415
				requestor.getResults());
2415
				requestor.getResults());
2416
	} else {
2416
	} else {
2417
		assertResults(
2417
		assertResults(
2418
				"TestAnnotation[TYPE_REF]{TestAnnotation, test0087, Ltest0087.TestAnnotation;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED + R_UNQUALIFIED) + "}",
2418
				"TestAnnotation[TYPE_REF]{TestAnnotation, test0087, Ltest0087.TestAnnotation;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED + R_UNQUALIFIED) + "}",
2419
				requestor.getResults());
2419
				requestor.getResults());
2420
	}
2420
	}
2421
}
2421
}
Lines 6634-6640 Link Here
6634
	            result.context);
6634
	            result.context);
6635
	    
6635
	    
6636
	    assertResults(
6636
	    assertResults(
6637
	            "ZZType.ZZAnnotation[TYPE_REF]{p.ZZType.ZZAnnotation, p, Lp.ZZType$ZZAnnotation;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}",
6637
	            "ZZType.ZZAnnotation[TYPE_REF]{p.ZZType.ZZAnnotation, p, Lp.ZZType$ZZAnnotation;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}",
6638
	            result.proposals);
6638
	            result.proposals);
6639
	} finally {
6639
	} finally {
6640
		if(aType != null) {
6640
		if(aType != null) {
Lines 9007-9013 Link Here
9007
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
9007
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
9008
9008
9009
	assertResults(
9009
	assertResults(
9010
			"QQAnnotation[TYPE_REF]{pkgannotations.QQAnnotation, pkgannotations, Lpkgannotations.QQAnnotation;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}",
9010
			"QQAnnotation[TYPE_REF]{pkgannotations.QQAnnotation, pkgannotations, Lpkgannotations.QQAnnotation;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}",
9011
			requestor.getResults());
9011
			requestor.getResults());
9012
}
9012
}
9013
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=123225
9013
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=123225
Lines 9437-9442 Link Here
9437
			"Top<java.lang.Object>.IZZException[TYPE_REF]{test.Top.IZZException, test, Ltest.Top<Ljava.lang.Object;>.IZZException;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_EXCEPTION + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED) + "}",
9437
			"Top<java.lang.Object>.IZZException[TYPE_REF]{test.Top.IZZException, test, Ltest.Top<Ljava.lang.Object;>.IZZException;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_EXCEPTION + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED) + "}",
9438
			requestor.getResults());
9438
			requestor.getResults());
9439
}
9439
}
9440
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158985
9441
public void test0301() throws JavaModelException {
9442
	this.workingCopies = new ICompilationUnit[3];
9443
	this.workingCopies[0] = getWorkingCopy(
9444
			"/Completion/src3/test/Test.java",
9445
			"package test;\n" +
9446
			"public class Test {\n" +
9447
			"    @ZZZ\n" +
9448
			"    public void method() {\n" +
9449
			"    }\n" +
9450
			"}");
9451
	
9452
	this.workingCopies[1] = getWorkingCopy(
9453
			"/Completion/src3/p/ZZZ1.java",
9454
			"package p;\n" +
9455
			"public @interface ZZZ1 {\n" +
9456
			"}");
9457
	
9458
	this.workingCopies[2] = getWorkingCopy(
9459
			"/Completion/src3/p/ZZZ2.java",
9460
			"package p;\n" +
9461
			"public @interface ZZZ2 {\n" +
9462
			"}");
9463
	
9464
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
9465
	String str = this.workingCopies[0].getSource();
9466
	String completeBehind = "ZZZ";
9467
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9468
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
9469
9470
	assertResults(
9471
			"ZZZ1[TYPE_REF]{p.ZZZ1, p, Lp.ZZZ1;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}\n" +
9472
			"ZZZ2[TYPE_REF]{p.ZZZ2, p, Lp.ZZZ2;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}",
9473
			requestor.getResults());
9474
}
9475
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158985
9476
public void test0302() throws JavaModelException {
9477
	this.workingCopies = new ICompilationUnit[3];
9478
	this.workingCopies[0] = getWorkingCopy(
9479
			"/Completion/src3/test/Test.java",
9480
			"package test;\n" +
9481
			"public class Test {\n" +
9482
			"    @ZZZ\n" +
9483
			"    public void method() {\n" +
9484
			"    }\n" +
9485
			"}");
9486
	
9487
	this.workingCopies[1] = getWorkingCopy(
9488
			"/Completion/src3/p/ZZZ1.java",
9489
			"package p;\n" +
9490
			"@java.lang.annotation.Target({java.lang.annotation.ElementType.TYPE})\n" +
9491
			"public @interface ZZZ1 {\n" +
9492
			"}");
9493
	
9494
	this.workingCopies[2] = getWorkingCopy(
9495
			"/Completion/src3/p/ZZZ2.java",
9496
			"package p;\n" +
9497
			"public @interface ZZZ2 {\n" +
9498
			"}");
9499
	
9500
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
9501
	String str = this.workingCopies[0].getSource();
9502
	String completeBehind = "ZZZ";
9503
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9504
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
9505
9506
	assertResults(
9507
			"ZZZ1[TYPE_REF]{p.ZZZ1, p, Lp.ZZZ1;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}\n" +
9508
			"ZZZ2[TYPE_REF]{p.ZZZ2, p, Lp.ZZZ2;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}",
9509
			requestor.getResults());
9510
}
9511
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158985
9512
public void test0303() throws JavaModelException {
9513
	this.workingCopies = new ICompilationUnit[3];
9514
	this.workingCopies[0] = getWorkingCopy(
9515
			"/Completion/src3/test/Test.java",
9516
			"package test;\n" +
9517
			"public class Test {\n" +
9518
			"    @ZZZ\n" +
9519
			"    public void method() {\n" +
9520
			"    }\n" +
9521
			"}");
9522
	
9523
	this.workingCopies[1] = getWorkingCopy(
9524
			"/Completion/src3/p/TOPZZZ1.java",
9525
			"package p;\n" +
9526
			"public class TOPZZZ1 {\n" +
9527
			"  @java.lang.annotation.Target({java.lang.annotation.ElementType.TYPE})\n" +
9528
			"  public @interface ZZZ1 {\n" +
9529
			"  }\n" +
9530
			"}");
9531
	
9532
	this.workingCopies[2] = getWorkingCopy(
9533
			"/Completion/src3/p/TOPZZZ2.java",
9534
			"package p;\n" +
9535
			"public class TOPZZZ2 {\n" +
9536
			"  public @interface ZZZ2 {\n" +
9537
			"  }\n" +
9538
			"}");
9539
	
9540
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
9541
	String str = this.workingCopies[0].getSource();
9542
	String completeBehind = "ZZZ";
9543
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9544
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
9545
9546
	assertResults(
9547
			"TOPZZZ1.ZZZ1[TYPE_REF]{p.TOPZZZ1.ZZZ1, p, Lp.TOPZZZ1$ZZZ1;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}\n" +
9548
			"TOPZZZ2.ZZZ2[TYPE_REF]{p.TOPZZZ2.ZZZ2, p, Lp.TOPZZZ2$ZZZ2;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}",
9549
			requestor.getResults());
9550
}
9551
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158985
9552
public void test0304() throws JavaModelException {
9553
	this.workingCopies = new ICompilationUnit[1];
9554
	this.workingCopies[0] = getWorkingCopy(
9555
			"/Completion/src3/test/Test.java",
9556
			"package test;\n" +
9557
			"@java.lang.annotation.Target({java.lang.annotation.ElementType.TYPE})\n" +
9558
			"@interface ZZZ1 {\n" +
9559
			"}\n" +
9560
			"@interface ZZZ2 {\n" +
9561
			"}\n" +
9562
			"public class Test {\n" +
9563
			"    @ZZZ\n" +
9564
			"    public void method() {\n" +
9565
			"    }\n" +
9566
			"}");
9567
	
9568
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
9569
	String str = this.workingCopies[0].getSource();
9570
	String completeBehind = "ZZZ";
9571
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9572
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
9573
9574
	assertResults(
9575
			"ZZZ1[TYPE_REF]{ZZZ1, test, Ltest.ZZZ1;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_ANNOTATION + R_NON_RESTRICTED) + "}\n" +
9576
			"ZZZ2[TYPE_REF]{ZZZ2, test, Ltest.ZZZ2;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}",
9577
			requestor.getResults());
9578
}
9579
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158985
9580
public void test0305() throws JavaModelException {
9581
	this.workingCopies = new ICompilationUnit[1];
9582
	this.workingCopies[0] = getWorkingCopy(
9583
			"/Completion/src3/test/Test.java",
9584
			"package test;\n" +
9585
			"class TOPZZZ1 {\n" +
9586
			"  @java.lang.annotation.Target({java.lang.annotation.ElementType.TYPE})\n" +
9587
			"  public @interface ZZZ1 {\n" +
9588
			"  }\n" +
9589
			"}\n" +
9590
			"class TOPZZZ2 {\n" +
9591
			"  public @interface ZZZ2 {\n" +
9592
			"  }\n" +
9593
			"}\n" +
9594
			"public class Test {\n" +
9595
			"    @ZZZ\n" +
9596
			"    public void method() {\n" +
9597
			"    }\n" +
9598
			"}");
9599
	
9600
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
9601
	String str = this.workingCopies[0].getSource();
9602
	String completeBehind = "ZZZ";
9603
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9604
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
9605
9606
	assertResults(
9607
			"TOPZZZ1.ZZZ1[TYPE_REF]{test.TOPZZZ1.ZZZ1, test, Ltest.TOPZZZ1$ZZZ1;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}\n" +
9608
			"TOPZZZ2.ZZZ2[TYPE_REF]{test.TOPZZZ2.ZZZ2, test, Ltest.TOPZZZ2$ZZZ2;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}",
9609
			requestor.getResults());
9610
}
9611
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158985
9612
public void test0306() throws JavaModelException {
9613
	this.workingCopies = new ICompilationUnit[1];
9614
	this.workingCopies[0] = getWorkingCopy(
9615
			"/Completion/src3/test/Test.java",
9616
			"package test;\n" +
9617
			"public class Test {\n" +
9618
			"  public static class TOPZZZ1 {\n" +
9619
			"    @java.lang.annotation.Target({java.lang.annotation.ElementType.TYPE})\n" +
9620
			"    public @interface ZZZ1 {\n" +
9621
			"    }\n" +
9622
			"  }\n" +
9623
			"  public static class TOPZZZ2 {\n" +
9624
			"    public @interface ZZZ2 {\n" +
9625
			"    }\n" +
9626
			"  }\n" +
9627
			"  public class TOPZZZ3 {\n" +
9628
			"    public @interface ZZZ3 {\n" +
9629
			"    }\n" +
9630
			"  }\n" +
9631
			"  @ZZZ\n" +
9632
			"  public void method() {\n" +
9633
			"  }\n" +
9634
			"}");
9635
	
9636
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
9637
	String str = this.workingCopies[0].getSource();
9638
	String completeBehind = "ZZZ";
9639
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9640
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
9641
9642
	assertResults(
9643
			"Test.TOPZZZ1.ZZZ1[TYPE_REF]{test.Test.TOPZZZ1.ZZZ1, test, Ltest.Test$TOPZZZ1$ZZZ1;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}\n" +
9644
			"Test.TOPZZZ2.ZZZ2[TYPE_REF]{test.Test.TOPZZZ2.ZZZ2, test, Ltest.Test$TOPZZZ2$ZZZ2;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}",
9645
			requestor.getResults());
9646
}
9647
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158985
9648
public void test0307() throws JavaModelException {
9649
	this.workingCopies = new ICompilationUnit[1];
9650
	this.workingCopies[0] = getWorkingCopy(
9651
			"/Completion/src3/test/Test.java",
9652
			"package test;\n" +
9653
			"public class Test {\n" +
9654
			"    @java.lang.annotation.Target({java.lang.annotation.ElementType.TYPE})\n" +
9655
			"    public @interface ZZZ1 {\n" +
9656
			"    }\n" +
9657
			"    public @interface ZZZ2 {\n" +
9658
			"    }\n" +
9659
			"    @ZZZ\n" +
9660
			"    public void method() {\n" +
9661
			"    }\n" +
9662
			"}");
9663
	
9664
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
9665
	String str = this.workingCopies[0].getSource();
9666
	String completeBehind = "ZZZ";
9667
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9668
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
9669
9670
	assertResults(
9671
			"Test.ZZZ1[TYPE_REF]{ZZZ1, test, Ltest.Test$ZZZ1;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_ANNOTATION + R_NON_RESTRICTED) + "}\n" +
9672
			"Test.ZZZ2[TYPE_REF]{ZZZ2, test, Ltest.Test$ZZZ2;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}",
9673
			requestor.getResults());
9674
}
9675
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158985
9676
public void test0308() throws JavaModelException {
9677
	this.workingCopies = new ICompilationUnit[4];
9678
	this.workingCopies[0] = getWorkingCopy(
9679
			"/Completion/src3/test/Test.java",
9680
			"package test;\n" +
9681
			"public class Test {\n" +
9682
			"    @ZZZ\n" +
9683
			"    public void method() {\n" +
9684
			"    }\n" +
9685
			"}");
9686
	
9687
	this.workingCopies[1] = getWorkingCopy(
9688
			"/Completion/src3/p/ZZZ1.java",
9689
			"package p;\n" +
9690
			"@java.lang.annotation.Target({java.lang.annotation.ElementType.TYPE})\n" +
9691
			"public @interface ZZZ1 {\n" +
9692
			"}");
9693
	
9694
	this.workingCopies[2] = getWorkingCopy(
9695
			"/Completion/src3/p/ZZZ2.java",
9696
			"package p;\n" +
9697
			"@java.lang.annotation.Target({java.lang.annotation.ElementType.METHOD})\n" +
9698
			"public @interface ZZZ2 {\n" +
9699
			"}");
9700
	
9701
	this.workingCopies[3] = getWorkingCopy(
9702
			"/Completion/src3/p/ZZZ3.java",
9703
			"package p;\n" +
9704
			"public @interface ZZZ3 {\n" +
9705
			"}");
9706
	
9707
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
9708
	String str = this.workingCopies[0].getSource();
9709
	String completeBehind = "ZZZ";
9710
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9711
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
9712
9713
	assertResults(
9714
			"ZZZ1[TYPE_REF]{p.ZZZ1, p, Lp.ZZZ1;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}\n" +
9715
			"ZZZ2[TYPE_REF]{p.ZZZ2, p, Lp.ZZZ2;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}\n" +
9716
			"ZZZ3[TYPE_REF]{p.ZZZ3, p, Lp.ZZZ3;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}",
9717
			requestor.getResults());
9718
}
9719
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158985
9720
public void test0309() throws JavaModelException {
9721
	this.workingCopies = new ICompilationUnit[4];
9722
	this.workingCopies[0] = getWorkingCopy(
9723
			"/Completion/src3/test/Test.java",
9724
			"package test;\n" +
9725
			"public class Test {\n" +
9726
			"    @ZZZ\n" +
9727
			"    public class TestInner {\n" +
9728
			"    }\n" +
9729
			"}");
9730
	
9731
	this.workingCopies[1] = getWorkingCopy(
9732
			"/Completion/src3/p/ZZZ1.java",
9733
			"package p;\n" +
9734
			"@java.lang.annotation.Target({java.lang.annotation.ElementType.FIELD})\n" +
9735
			"public @interface ZZZ1 {\n" +
9736
			"}");
9737
	
9738
	this.workingCopies[2] = getWorkingCopy(
9739
			"/Completion/src3/p/ZZZ2.java",
9740
			"package p;\n" +
9741
			"@java.lang.annotation.Target({java.lang.annotation.ElementType.TYPE})\n" +
9742
			"public @interface ZZZ2 {\n" +
9743
			"}");
9744
	
9745
	this.workingCopies[3] = getWorkingCopy(
9746
			"/Completion/src3/p/ZZZ3.java",
9747
			"package p;\n" +
9748
			"public @interface ZZZ3 {\n" +
9749
			"}");
9750
	
9751
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
9752
	String str = this.workingCopies[0].getSource();
9753
	String completeBehind = "ZZZ";
9754
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9755
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
9756
9757
	assertResults(
9758
			"ZZZ1[TYPE_REF]{p.ZZZ1, p, Lp.ZZZ1;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}\n" +
9759
			"ZZZ2[TYPE_REF]{p.ZZZ2, p, Lp.ZZZ2;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}\n" +
9760
			"ZZZ3[TYPE_REF]{p.ZZZ3, p, Lp.ZZZ3;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}",
9761
			requestor.getResults());
9762
}
9763
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158985
9764
public void test0310() throws JavaModelException {
9765
	this.workingCopies = new ICompilationUnit[4];
9766
	this.workingCopies[0] = getWorkingCopy(
9767
			"/Completion/src3/test/Test.java",
9768
			"package test;\n" +
9769
			"public class Test {\n" +
9770
			"    @ZZZ\n" +
9771
			"    public int field;\n" +
9772
			"}");
9773
	
9774
	this.workingCopies[1] = getWorkingCopy(
9775
			"/Completion/src3/p/ZZZ1.java",
9776
			"package p;\n" +
9777
			"@java.lang.annotation.Target({java.lang.annotation.ElementType.TYPE})\n" +
9778
			"public @interface ZZZ1 {\n" +
9779
			"}");
9780
	
9781
	this.workingCopies[2] = getWorkingCopy(
9782
			"/Completion/src3/p/ZZZ2.java",
9783
			"package p;\n" +
9784
			"@java.lang.annotation.Target({java.lang.annotation.ElementType.FIELD})\n" +
9785
			"public @interface ZZZ2 {\n" +
9786
			"}");
9787
	
9788
	this.workingCopies[3] = getWorkingCopy(
9789
			"/Completion/src3/p/ZZZ3.java",
9790
			"package p;\n" +
9791
			"public @interface ZZZ3 {\n" +
9792
			"}");
9793
	
9794
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
9795
	String str = this.workingCopies[0].getSource();
9796
	String completeBehind = "ZZZ";
9797
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9798
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
9799
9800
	assertResults(
9801
			"ZZZ1[TYPE_REF]{p.ZZZ1, p, Lp.ZZZ1;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}\n" +
9802
			"ZZZ2[TYPE_REF]{p.ZZZ2, p, Lp.ZZZ2;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}\n" +
9803
			"ZZZ3[TYPE_REF]{p.ZZZ3, p, Lp.ZZZ3;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}",
9804
			requestor.getResults());
9805
}
9806
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158985
9807
public void test0311() throws JavaModelException {
9808
	this.workingCopies = new ICompilationUnit[4];
9809
	this.workingCopies[0] = getWorkingCopy(
9810
			"/Completion/src3/test/Test.java",
9811
			"package test;\n" +
9812
			"public class Test {\n" +
9813
			"    public void foo(@ZZZ int param){}\n" +
9814
			"}");
9815
	
9816
	this.workingCopies[1] = getWorkingCopy(
9817
			"/Completion/src3/p/ZZZ1.java",
9818
			"package p;\n" +
9819
			"@java.lang.annotation.Target({java.lang.annotation.ElementType.TYPE})\n" +
9820
			"public @interface ZZZ1 {\n" +
9821
			"}");
9822
	
9823
	this.workingCopies[2] = getWorkingCopy(
9824
			"/Completion/src3/p/ZZZ2.java",
9825
			"package p;\n" +
9826
			"@java.lang.annotation.Target({java.lang.annotation.ElementType.PARAMETER})\n" +
9827
			"public @interface ZZZ2 {\n" +
9828
			"}");
9829
	
9830
	this.workingCopies[3] = getWorkingCopy(
9831
			"/Completion/src3/p/ZZZ3.java",
9832
			"package p;\n" +
9833
			"public @interface ZZZ3 {\n" +
9834
			"}");
9835
	
9836
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
9837
	String str = this.workingCopies[0].getSource();
9838
	String completeBehind = "ZZZ";
9839
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9840
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
9841
9842
	assertResults(
9843
			"ZZZ1[TYPE_REF]{p.ZZZ1, p, Lp.ZZZ1;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}\n" +
9844
			"ZZZ2[TYPE_REF]{p.ZZZ2, p, Lp.ZZZ2;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}\n" +
9845
			"ZZZ3[TYPE_REF]{p.ZZZ3, p, Lp.ZZZ3;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}",
9846
			requestor.getResults());
9847
}
9848
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158985
9849
public void test0312() throws JavaModelException {
9850
	this.workingCopies = new ICompilationUnit[4];
9851
	this.workingCopies[0] = getWorkingCopy(
9852
			"/Completion/src3/test/Test.java",
9853
			"package test;\n" +
9854
			"public class Test {\n" +
9855
			"    @ZZZ\n" +
9856
			"    public Test(){}\n" +
9857
			"}");
9858
	
9859
	this.workingCopies[1] = getWorkingCopy(
9860
			"/Completion/src3/p/ZZZ1.java",
9861
			"package p;\n" +
9862
			"@java.lang.annotation.Target({java.lang.annotation.ElementType.TYPE})\n" +
9863
			"public @interface ZZZ1 {\n" +
9864
			"}");
9865
	
9866
	this.workingCopies[2] = getWorkingCopy(
9867
			"/Completion/src3/p/ZZZ2.java",
9868
			"package p;\n" +
9869
			"@java.lang.annotation.Target({java.lang.annotation.ElementType.CONSTRUCTOR})\n" +
9870
			"public @interface ZZZ2 {\n" +
9871
			"}");
9872
	
9873
	this.workingCopies[3] = getWorkingCopy(
9874
			"/Completion/src3/p/ZZZ3.java",
9875
			"package p;\n" +
9876
			"public @interface ZZZ3 {\n" +
9877
			"}");
9878
	
9879
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
9880
	String str = this.workingCopies[0].getSource();
9881
	String completeBehind = "ZZZ";
9882
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9883
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
9884
9885
	assertResults(
9886
			"ZZZ1[TYPE_REF]{p.ZZZ1, p, Lp.ZZZ1;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}\n" +
9887
			"ZZZ2[TYPE_REF]{p.ZZZ2, p, Lp.ZZZ2;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}\n" +
9888
			"ZZZ3[TYPE_REF]{p.ZZZ3, p, Lp.ZZZ3;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}",
9889
			requestor.getResults());
9890
}
9891
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158985
9892
// When the completion is inside a method body the annotation cannot be accuratly attached to the correct node by completino recovery.
9893
// So relevance based on annotation target are ignored.
9894
public void test0313() throws JavaModelException {
9895
	this.workingCopies = new ICompilationUnit[4];
9896
	this.workingCopies[0] = getWorkingCopy(
9897
			"/Completion/src3/test/Test.java",
9898
			"package test;\n" +
9899
			"public class Test {\n" +
9900
			"    {\n" +
9901
			"        @ZZZ\n" +
9902
			"        int var = 0;\n" +
9903
			"    }\n" +
9904
			"}");
9905
	
9906
	this.workingCopies[1] = getWorkingCopy(
9907
			"/Completion/src3/p/ZZZ1.java",
9908
			"package p;\n" +
9909
			"@java.lang.annotation.Target({java.lang.annotation.ElementType.TYPE})\n" +
9910
			"public @interface ZZZ1 {\n" +
9911
			"}");
9912
	
9913
	this.workingCopies[2] = getWorkingCopy(
9914
			"/Completion/src3/p/ZZZ2.java",
9915
			"package p;\n" +
9916
			"@java.lang.annotation.Target({java.lang.annotation.ElementType.LOCAL_VARIABLE})\n" +
9917
			"public @interface ZZZ2 {\n" +
9918
			"}");
9919
	
9920
	this.workingCopies[3] = getWorkingCopy(
9921
			"/Completion/src3/p/ZZZ3.java",
9922
			"package p;\n" +
9923
			"public @interface ZZZ3 {\n" +
9924
			"}");
9925
	
9926
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
9927
	String str = this.workingCopies[0].getSource();
9928
	String completeBehind = "ZZZ";
9929
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9930
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
9931
9932
	assertResults(
9933
			"ZZZ1[TYPE_REF]{p.ZZZ1, p, Lp.ZZZ1;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}\n" +
9934
			"ZZZ2[TYPE_REF]{p.ZZZ2, p, Lp.ZZZ2;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}\n" +
9935
			"ZZZ3[TYPE_REF]{p.ZZZ3, p, Lp.ZZZ3;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}",
9936
			requestor.getResults());
9937
}
9938
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158985
9939
public void test0314() throws JavaModelException {
9940
	this.workingCopies = new ICompilationUnit[4];
9941
	this.workingCopies[0] = getWorkingCopy(
9942
			"/Completion/src3/test/Test.java",
9943
			"package test;\n" +
9944
			"public class Test {\n" +
9945
			"    @ZZZ\n" +
9946
			"    public @interface TestInner {}\n" +
9947
			"}");
9948
	
9949
	this.workingCopies[1] = getWorkingCopy(
9950
			"/Completion/src3/p/ZZZ1.java",
9951
			"package p;\n" +
9952
			"@java.lang.annotation.Target({java.lang.annotation.ElementType.METHOD})\n" +
9953
			"public @interface ZZZ1 {\n" +
9954
			"}");
9955
	
9956
	this.workingCopies[2] = getWorkingCopy(
9957
			"/Completion/src3/p/ZZZ2.java",
9958
			"package p;\n" +
9959
			"@java.lang.annotation.Target({java.lang.annotation.ElementType.ANNOTATION_TYPE})\n" +
9960
			"public @interface ZZZ2 {\n" +
9961
			"}");
9962
	
9963
	this.workingCopies[3] = getWorkingCopy(
9964
			"/Completion/src3/p/ZZZ3.java",
9965
			"package p;\n" +
9966
			"public @interface ZZZ3 {\n" +
9967
			"}");
9968
	
9969
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
9970
	String str = this.workingCopies[0].getSource();
9971
	String completeBehind = "ZZZ";
9972
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
9973
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
9974
9975
	assertResults(
9976
			"ZZZ1[TYPE_REF]{p.ZZZ1, p, Lp.ZZZ1;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}\n" +
9977
			"ZZZ2[TYPE_REF]{p.ZZZ2, p, Lp.ZZZ2;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}\n" +
9978
			"ZZZ3[TYPE_REF]{p.ZZZ3, p, Lp.ZZZ3;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}",
9979
			requestor.getResults());
9980
}
9981
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158985
9982
public void test0315() throws JavaModelException {
9983
	this.workingCopies = new ICompilationUnit[4];
9984
	this.workingCopies[0] = getWorkingCopy(
9985
			"/Completion/src3/test/Test.java",
9986
			"@ZZZ package test;\n" +
9987
			"public class Test {\n" +
9988
			"}");
9989
	
9990
	this.workingCopies[1] = getWorkingCopy(
9991
			"/Completion/src3/p/ZZZ1.java",
9992
			"package p;\n" +
9993
			"@java.lang.annotation.Target({java.lang.annotation.ElementType.TYPE})\n" +
9994
			"public @interface ZZZ1 {\n" +
9995
			"}");
9996
	
9997
	this.workingCopies[2] = getWorkingCopy(
9998
			"/Completion/src3/p/ZZZ2.java",
9999
			"package p;\n" +
10000
			"@java.lang.annotation.Target({java.lang.annotation.ElementType.PACKAGE})\n" +
10001
			"public @interface ZZZ2 {\n" +
10002
			"}");
10003
	
10004
	this.workingCopies[3] = getWorkingCopy(
10005
			"/Completion/src3/p/ZZZ3.java",
10006
			"package p;\n" +
10007
			"public @interface ZZZ3 {\n" +
10008
			"}");
10009
	
10010
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
10011
	String str = this.workingCopies[0].getSource();
10012
	String completeBehind = "ZZZ";
10013
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10014
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
10015
10016
	assertResults(
10017
			"ZZZ2[TYPE_REF]{p.ZZZ2, p, Lp.ZZZ2;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}\n" +
10018
			"ZZZ3[TYPE_REF]{p.ZZZ3, p, Lp.ZZZ3;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}",
10019
			requestor.getResults());
10020
}
10021
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158985
10022
public void test0316() throws JavaModelException {
10023
	this.workingCopies = new ICompilationUnit[4];
10024
	this.workingCopies[0] = getWorkingCopy(
10025
			"/Completion/src3/test/Test.java",
10026
			"package test;\n" +
10027
			"public class Test {\n" +
10028
			"    @ZZZ\n" +
10029
			"    public Test(){}\n" +
10030
			"}");
10031
	
10032
	this.workingCopies[1] = getWorkingCopy(
10033
			"/Completion/src3/p/ZZZ1.java",
10034
			"package p;\n" +
10035
			"@java.lang.annotation.Target({java.lang.annotation.ElementType.METHOD})\n" +
10036
			"public @interface ZZZ1 {\n" +
10037
			"}");
10038
	
10039
	this.workingCopies[2] = getWorkingCopy(
10040
			"/Completion/src3/p/ZZZ2.java",
10041
			"package p;\n" +
10042
			"@java.lang.annotation.Target({java.lang.annotation.ElementType.CONSTRUCTOR})\n" +
10043
			"public @interface ZZZ2 {\n" +
10044
			"}");
10045
	
10046
	this.workingCopies[3] = getWorkingCopy(
10047
			"/Completion/src3/p/ZZZ3.java",
10048
			"package p;\n" +
10049
			"public @interface ZZZ3 {\n" +
10050
			"}");
10051
	
10052
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
10053
	String str = this.workingCopies[0].getSource();
10054
	String completeBehind = "ZZZ";
10055
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10056
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
10057
10058
	assertResults(
10059
			"ZZZ1[TYPE_REF]{p.ZZZ1, p, Lp.ZZZ1;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}\n" +
10060
			"ZZZ2[TYPE_REF]{p.ZZZ2, p, Lp.ZZZ2;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}\n" +
10061
			"ZZZ3[TYPE_REF]{p.ZZZ3, p, Lp.ZZZ3;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}",
10062
			requestor.getResults());
10063
}
10064
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158985
10065
public void test0317() throws JavaModelException {
10066
	this.workingCopies = new ICompilationUnit[4];
10067
	this.workingCopies[0] = getWorkingCopy(
10068
			"/Completion/src3/test/Test.java",
10069
			"package test;\n" +
10070
			"public class Test {\n" +
10071
			"    @ZZZ\n" +
10072
			"    public @interface TestInner {}\n" +
10073
			"}");
10074
	
10075
	this.workingCopies[1] = getWorkingCopy(
10076
			"/Completion/src3/p/ZZZ1.java",
10077
			"package p;\n" +
10078
			"@java.lang.annotation.Target({java.lang.annotation.ElementType.TYPE})\n" +
10079
			"public @interface ZZZ1 {\n" +
10080
			"}");
10081
	
10082
	this.workingCopies[2] = getWorkingCopy(
10083
			"/Completion/src3/p/ZZZ2.java",
10084
			"package p;\n" +
10085
			"@java.lang.annotation.Target({java.lang.annotation.ElementType.ANNOTATION_TYPE})\n" +
10086
			"public @interface ZZZ2 {\n" +
10087
			"}");
10088
	
10089
	this.workingCopies[3] = getWorkingCopy(
10090
			"/Completion/src3/p/ZZZ3.java",
10091
			"package p;\n" +
10092
			"public @interface ZZZ3 {\n" +
10093
			"}");
10094
	
10095
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
10096
	String str = this.workingCopies[0].getSource();
10097
	String completeBehind = "ZZZ";
10098
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10099
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
10100
10101
	assertResults(
10102
			"ZZZ1[TYPE_REF]{p.ZZZ1, p, Lp.ZZZ1;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}\n" +
10103
			"ZZZ2[TYPE_REF]{p.ZZZ2, p, Lp.ZZZ2;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}\n" +
10104
			"ZZZ3[TYPE_REF]{p.ZZZ3, p, Lp.ZZZ3;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}",
10105
			requestor.getResults());
10106
}
10107
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158985
10108
public void test0318() throws JavaModelException {
10109
	this.workingCopies = new ICompilationUnit[3];
10110
	this.workingCopies[0] = getWorkingCopy(
10111
			"/Completion/src3/test/Test.java",
10112
			"package test;\n" +
10113
			"@ZZZ\n" +
10114
			"import test.*;\n" +
10115
			"public class Test {\n" +
10116
			"}");
10117
	
10118
	this.workingCopies[1] = getWorkingCopy(
10119
			"/Completion/src3/p/ZZZ1.java",
10120
			"package p;\n" +
10121
			"@java.lang.annotation.Target({java.lang.annotation.ElementType.TYPE})\n" +
10122
			"public @interface ZZZ1 {\n" +
10123
			"}");
10124
	
10125
	this.workingCopies[2] = getWorkingCopy(
10126
			"/Completion/src3/p/ZZZ2.java",
10127
			"package p;\n" +
10128
			"public @interface ZZZ2 {\n" +
10129
			"}");
10130
	
10131
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
10132
	String str = this.workingCopies[0].getSource();
10133
	String completeBehind = "ZZZ";
10134
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10135
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
10136
10137
	assertResults(
10138
			"ZZZ1[TYPE_REF]{p.ZZZ1, p, Lp.ZZZ1;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}\n" +
10139
			"ZZZ2[TYPE_REF]{p.ZZZ2, p, Lp.ZZZ2;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}",
10140
			requestor.getResults());
10141
}
10142
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158985
10143
public void test0319() throws JavaModelException {
10144
	this.workingCopies = new ICompilationUnit[3];
10145
	this.workingCopies[0] = getWorkingCopy(
10146
			"/Completion/src3/test/Test.java",
10147
			"package test;\n" +
10148
			"public class Test {\n" +
10149
			"    @ZZZ\n" +
10150
			"    {}\n" +
10151
			"    public void foo() {}\n" +
10152
			"}");
10153
	
10154
	this.workingCopies[1] = getWorkingCopy(
10155
			"/Completion/src3/p/ZZZ1.java",
10156
			"package p;\n" +
10157
			"@java.lang.annotation.Target({java.lang.annotation.ElementType.METHOD})\n" +
10158
			"public @interface ZZZ1 {\n" +
10159
			"}");
10160
	
10161
	this.workingCopies[2] = getWorkingCopy(
10162
			"/Completion/src3/p/ZZZ2.java",
10163
			"package p;\n" +
10164
			"public @interface ZZZ2 {\n" +
10165
			"}");
10166
	
10167
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
10168
	String str = this.workingCopies[0].getSource();
10169
	String completeBehind = "ZZZ";
10170
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10171
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
10172
10173
	assertResults(
10174
			"ZZZ1[TYPE_REF]{p.ZZZ1, p, Lp.ZZZ1;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}\n" +
10175
			"ZZZ2[TYPE_REF]{p.ZZZ2, p, Lp.ZZZ2;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}",
10176
			requestor.getResults());
10177
}
10178
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158985
10179
public void test0320() throws JavaModelException {
10180
	this.workingCopies = new ICompilationUnit[5];
10181
	this.workingCopies[0] = getWorkingCopy(
10182
			"/Completion/src3/test/Test.java",
10183
			"package test;\n" +
10184
			"public class Test {\n" +
10185
			"    @ZZZ\n" +
10186
			"    {\n" +
10187
			"        int var = 0;\n" +
10188
			"    }\n" +
10189
			"}");
10190
	
10191
	this.workingCopies[1] = getWorkingCopy(
10192
			"/Completion/src3/p/ZZZ1.java",
10193
			"package p;\n" +
10194
			"@java.lang.annotation.Target({java.lang.annotation.ElementType.FIELD})\n" +
10195
			"public @interface ZZZ1 {\n" +
10196
			"}");
10197
	
10198
	this.workingCopies[2] = getWorkingCopy(
10199
			"/Completion/src3/p/ZZZ2.java",
10200
			"package p;\n" +
10201
			"@java.lang.annotation.Target({java.lang.annotation.ElementType.PARAMETER})\n" +
10202
			"public @interface ZZZ2 {\n" +
10203
			"}");
10204
	
10205
	this.workingCopies[3] = getWorkingCopy(
10206
			"/Completion/src3/p/ZZZ3.java",
10207
			"package p;\n" +
10208
			"@java.lang.annotation.Target({java.lang.annotation.ElementType.LOCAL_VARIABLE})\n" +
10209
			"public @interface ZZZ3 {\n" +
10210
			"}");
10211
	
10212
	this.workingCopies[4] = getWorkingCopy(
10213
			"/Completion/src3/p/ZZZ4.java",
10214
			"package p;\n" +
10215
			"public @interface ZZZ4 {\n" +
10216
			"}");
10217
	
10218
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
10219
	String str = this.workingCopies[0].getSource();
10220
	String completeBehind = "ZZZ";
10221
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10222
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
10223
10224
	assertResults(
10225
			"ZZZ1[TYPE_REF]{p.ZZZ1, p, Lp.ZZZ1;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}\n" +
10226
			"ZZZ2[TYPE_REF]{p.ZZZ2, p, Lp.ZZZ2;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}\n" +
10227
			"ZZZ3[TYPE_REF]{p.ZZZ3, p, Lp.ZZZ3;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}\n" +
10228
			"ZZZ4[TYPE_REF]{p.ZZZ4, p, Lp.ZZZ4;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}",
10229
			requestor.getResults());
10230
}
10231
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158985
10232
public void test0321() throws JavaModelException {
10233
	this.workingCopies = new ICompilationUnit[3];
10234
	this.workingCopies[0] = getWorkingCopy(
10235
			"/Completion/src3/test/Test.java",
10236
			"package test;\n" +
10237
			"public class Test {\n" +
10238
			"    @ZZZ({})\n" +
10239
			"    int var = 0;\n" +
10240
			"}");
10241
	
10242
	this.workingCopies[1] = getWorkingCopy(
10243
			"/Completion/src3/p/ZZZ1.java",
10244
			"package p;\n" +
10245
			"@java.lang.annotation.Target({java.lang.annotation.ElementType.FIELD})\n" +
10246
			"public @interface ZZZ1 {\n" +
10247
			"}");
10248
	
10249
	this.workingCopies[2] = getWorkingCopy(
10250
			"/Completion/src3/p/ZZZ2.java",
10251
			"package p;\n" +
10252
			"public @interface ZZZ2 {\n" +
10253
			"}");
10254
	
10255
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
10256
	String str = this.workingCopies[0].getSource();
10257
	String completeBehind = "ZZZ";
10258
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10259
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
10260
10261
	assertResults(
10262
			"ZZZ1[TYPE_REF]{p.ZZZ1, p, Lp.ZZZ1;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}\n" +
10263
			"ZZZ2[TYPE_REF]{p.ZZZ2, p, Lp.ZZZ2;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}",
10264
			requestor.getResults());
10265
}
10266
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158985
10267
public void test0321b() throws JavaModelException {
10268
	this.workingCopies = new ICompilationUnit[3];
10269
	this.workingCopies[0] = getWorkingCopy(
10270
			"/Completion/src3/test/Test.java",
10271
			"package test;\n" +
10272
			"public class Test {\n" +
10273
			"    @ZZZ(value={})\n" +
10274
			"    int var = 0;\n" +
10275
			"}");
10276
	
10277
	this.workingCopies[1] = getWorkingCopy(
10278
			"/Completion/src3/p/ZZZ1.java",
10279
			"package p;\n" +
10280
			"@java.lang.annotation.Target({java.lang.annotation.ElementType.FIELD})\n" +
10281
			"public @interface ZZZ1 {\n" +
10282
			"}");
10283
	
10284
	this.workingCopies[2] = getWorkingCopy(
10285
			"/Completion/src3/p/ZZZ2.java",
10286
			"package p;\n" +
10287
			"public @interface ZZZ2 {\n" +
10288
			"}");
10289
	
10290
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
10291
	String str = this.workingCopies[0].getSource();
10292
	String completeBehind = "ZZZ";
10293
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10294
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
10295
10296
	assertResults(
10297
			"ZZZ1[TYPE_REF]{p.ZZZ1, p, Lp.ZZZ1;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}\n" +
10298
			"ZZZ2[TYPE_REF]{p.ZZZ2, p, Lp.ZZZ2;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}",
10299
			requestor.getResults());
10300
}
10301
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158985
10302
public void test0322() throws JavaModelException {
10303
	this.workingCopies = new ICompilationUnit[3];
10304
	this.workingCopies[0] = getWorkingCopy(
10305
			"/Completion/src3/test/Test.java",
10306
			"package test;\n" +
10307
			"public class Test {\n" +
10308
			"    @ZZZ @Annot\n" +
10309
			"    int var = 0;\n" +
10310
			"}");
10311
	
10312
	this.workingCopies[1] = getWorkingCopy(
10313
			"/Completion/src3/p/ZZZ1.java",
10314
			"package p;\n" +
10315
			"@java.lang.annotation.Target({java.lang.annotation.ElementType.FIELD})\n" +
10316
			"public @interface ZZZ1 {\n" +
10317
			"}");
10318
	
10319
	this.workingCopies[2] = getWorkingCopy(
10320
			"/Completion/src3/p/ZZZ2.java",
10321
			"package p;\n" +
10322
			"public @interface ZZZ2 {\n" +
10323
			"}");
10324
	
10325
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
10326
	String str = this.workingCopies[0].getSource();
10327
	String completeBehind = "ZZZ";
10328
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10329
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
10330
10331
	assertResults(
10332
			"ZZZ1[TYPE_REF]{p.ZZZ1, p, Lp.ZZZ1;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}\n" +
10333
			"ZZZ2[TYPE_REF]{p.ZZZ2, p, Lp.ZZZ2;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}",
10334
			requestor.getResults());
10335
}
10336
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158985
10337
public void test0323() throws JavaModelException {
10338
	this.workingCopies = new ICompilationUnit[3];
10339
	this.workingCopies[0] = getWorkingCopy(
10340
			"/Completion/src3/test/Test.java",
10341
			"package test;\n" +
10342
			"public class Test {\n" +
10343
			"    @ZZZ @Annot({})\n" +
10344
			"    int var = 0;\n" +
10345
			"}");
10346
	
10347
	this.workingCopies[1] = getWorkingCopy(
10348
			"/Completion/src3/p/ZZZ1.java",
10349
			"package p;\n" +
10350
			"@java.lang.annotation.Target({java.lang.annotation.ElementType.FIELD})\n" +
10351
			"public @interface ZZZ1 {\n" +
10352
			"}");
10353
	
10354
	this.workingCopies[2] = getWorkingCopy(
10355
			"/Completion/src3/p/ZZZ2.java",
10356
			"package p;\n" +
10357
			"public @interface ZZZ2 {\n" +
10358
			"}");
10359
	
10360
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
10361
	String str = this.workingCopies[0].getSource();
10362
	String completeBehind = "ZZZ";
10363
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10364
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
10365
10366
	assertResults(
10367
			"ZZZ1[TYPE_REF]{p.ZZZ1, p, Lp.ZZZ1;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}\n" +
10368
			"ZZZ2[TYPE_REF]{p.ZZZ2, p, Lp.ZZZ2;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}",
10369
			requestor.getResults());
10370
}
10371
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158985
10372
public void test0324() throws JavaModelException {
10373
	this.workingCopies = new ICompilationUnit[4];
10374
	this.workingCopies[0] = getWorkingCopy(
10375
			"/Completion/src3/test/Test.java",
10376
			"package test;\n" +
10377
			"public class Test {\n" +
10378
			"    public void foo(@ZZZ int param){}\n" +
10379
			"}");
10380
	
10381
	this.workingCopies[1] = getWorkingCopy(
10382
			"/Completion/src3/p/ZZZ1.java",
10383
			"package p;\n" +
10384
			"@java.lang.annotation.Target({java.lang.annotation.ElementType.FIELD})\n" +
10385
			"public @interface ZZZ1 {\n" +
10386
			"}");
10387
	
10388
	this.workingCopies[2] = getWorkingCopy(
10389
			"/Completion/src3/p/ZZZ2.java",
10390
			"package p;\n" +
10391
			"@java.lang.annotation.Target({java.lang.annotation.ElementType.PARAMETER})\n" +
10392
			"public @interface ZZZ2 {\n" +
10393
			"}");
10394
	
10395
	this.workingCopies[3] = getWorkingCopy(
10396
			"/Completion/src3/p/ZZZ3.java",
10397
			"package p;\n" +
10398
			"public @interface ZZZ3 {\n" +
10399
			"}");
10400
	
10401
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
10402
	String str = this.workingCopies[0].getSource();
10403
	String completeBehind = "ZZZ";
10404
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10405
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
10406
10407
	assertResults(
10408
			"ZZZ1[TYPE_REF]{p.ZZZ1, p, Lp.ZZZ1;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}\n" +
10409
			"ZZZ2[TYPE_REF]{p.ZZZ2, p, Lp.ZZZ2;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}\n" +
10410
			"ZZZ3[TYPE_REF]{p.ZZZ3, p, Lp.ZZZ3;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}",
10411
			requestor.getResults());
10412
}
10413
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158985
10414
public void test0325() throws JavaModelException {
10415
	this.workingCopies = new ICompilationUnit[4];
10416
	this.workingCopies[0] = getWorkingCopy(
10417
			"/Completion/src3/test/Test.java",
10418
			"package test;\n" +
10419
			"public class Test {\n" +
10420
			"    @p.Annot(@ZZZ)\n" +
10421
			"    public void foo(){}\n" +
10422
			"}");
10423
	
10424
	this.workingCopies[1] = getWorkingCopy(
10425
			"/Completion/src3/p/ZZZ1.java",
10426
			"package p;\n" +
10427
			"@java.lang.annotation.Target({java.lang.annotation.ElementType.METHOD})\n" +
10428
			"public @interface ZZZ1 {\n" +
10429
			"}");
10430
	
10431
	this.workingCopies[2] = getWorkingCopy(
10432
			"/Completion/src3/p/ZZZ2.java",
10433
			"package p;\n" +
10434
			"public @interface ZZZ2 {\n" +
10435
			"}");
10436
	
10437
	this.workingCopies[3] = getWorkingCopy(
10438
			"/Completion/src3/p/Annot.java",
10439
			"package p;\n" +
10440
			"public @interface Annot {\n" +
10441
			"    ZZZ2 value();\n" +
10442
			"}");
10443
	
10444
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
10445
	String str = this.workingCopies[0].getSource();
10446
	String completeBehind = "ZZZ";
10447
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10448
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
10449
10450
	assertResults(
10451
			"ZZZ1[TYPE_REF]{p.ZZZ1, p, Lp.ZZZ1;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}\n" +
10452
			"ZZZ2[TYPE_REF]{p.ZZZ2, p, Lp.ZZZ2;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}",
10453
			requestor.getResults());
10454
}
10455
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158985
10456
public void test0326() throws JavaModelException {
10457
	this.workingCopies = new ICompilationUnit[4];
10458
	this.workingCopies[0] = getWorkingCopy(
10459
			"/Completion/src3/test/Test.java",
10460
			"package test;\n" +
10461
			"public class Test {\n" +
10462
			"    @p.Annot(@ZZZ(value=0))\n" +
10463
			"    public void foo(){}\n" +
10464
			"}");
10465
	
10466
	this.workingCopies[1] = getWorkingCopy(
10467
			"/Completion/src3/p/ZZZ1.java",
10468
			"package p;\n" +
10469
			"@java.lang.annotation.Target({java.lang.annotation.ElementType.METHOD})\n" +
10470
			"public @interface ZZZ1 {\n" +
10471
			"}");
10472
	
10473
	this.workingCopies[2] = getWorkingCopy(
10474
			"/Completion/src3/p/ZZZ2.java",
10475
			"package p;\n" +
10476
			"public @interface ZZZ2 {\n" +
10477
			"}");
10478
	
10479
	this.workingCopies[3] = getWorkingCopy(
10480
			"/Completion/src3/p/Annot.java",
10481
			"package p;\n" +
10482
			"public @interface Annot {\n" +
10483
			"    ZZZ2 value();\n" +
10484
			"}");
10485
	
10486
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
10487
	String str = this.workingCopies[0].getSource();
10488
	String completeBehind = "ZZZ";
10489
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10490
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
10491
10492
	assertResults(
10493
			"ZZZ1[TYPE_REF]{p.ZZZ1, p, Lp.ZZZ1;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}\n" +
10494
			"ZZZ2[TYPE_REF]{p.ZZZ2, p, Lp.ZZZ2;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}",
10495
			requestor.getResults());
10496
}
10497
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158985
10498
public void test0327() throws JavaModelException {
10499
	this.workingCopies = new ICompilationUnit[4];
10500
	this.workingCopies[0] = getWorkingCopy(
10501
			"/Completion/src3/test/Test.java",
10502
			"package test;\n" +
10503
			"public class Test {\n" +
10504
			"    @p.Annot(@ZZZ(value=0\n" +
10505
			"    public void foo(){}\n" +
10506
			"}");
10507
	
10508
	this.workingCopies[1] = getWorkingCopy(
10509
			"/Completion/src3/p/ZZZ1.java",
10510
			"package p;\n" +
10511
			"@java.lang.annotation.Target({java.lang.annotation.ElementType.METHOD})\n" +
10512
			"public @interface ZZZ1 {\n" +
10513
			"}");
10514
	
10515
	this.workingCopies[2] = getWorkingCopy(
10516
			"/Completion/src3/p/ZZZ2.java",
10517
			"package p;\n" +
10518
			"public @interface ZZZ2 {\n" +
10519
			"}");
10520
	
10521
	this.workingCopies[3] = getWorkingCopy(
10522
			"/Completion/src3/p/Annot.java",
10523
			"package p;\n" +
10524
			"public @interface Annot {\n" +
10525
			"    ZZZ2 value();\n" +
10526
			"}");
10527
	
10528
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
10529
	String str = this.workingCopies[0].getSource();
10530
	String completeBehind = "ZZZ";
10531
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10532
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
10533
10534
	assertResults(
10535
			"ZZZ1[TYPE_REF]{p.ZZZ1, p, Lp.ZZZ1;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}\n" +
10536
			"ZZZ2[TYPE_REF]{p.ZZZ2, p, Lp.ZZZ2;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}",
10537
			requestor.getResults());
10538
}
10539
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158985
10540
public void test0328() throws JavaModelException {
10541
	this.workingCopies = new ICompilationUnit[4];
10542
	this.workingCopies[0] = getWorkingCopy(
10543
			"/Completion/src3/test/Test.java",
10544
			"package test;\n" +
10545
			"public class Test {\n" +
10546
			"    @p.Annot(@ZZZ(value=\n" +
10547
			"    public void foo(){}\n" +
10548
			"}");
10549
	
10550
	this.workingCopies[1] = getWorkingCopy(
10551
			"/Completion/src3/p/ZZZ1.java",
10552
			"package p;\n" +
10553
			"@java.lang.annotation.Target({java.lang.annotation.ElementType.METHOD})\n" +
10554
			"public @interface ZZZ1 {\n" +
10555
			"}");
10556
	
10557
	this.workingCopies[2] = getWorkingCopy(
10558
			"/Completion/src3/p/ZZZ2.java",
10559
			"package p;\n" +
10560
			"public @interface ZZZ2 {\n" +
10561
			"}");
10562
	
10563
	this.workingCopies[3] = getWorkingCopy(
10564
			"/Completion/src3/p/Annot.java",
10565
			"package p;\n" +
10566
			"public @interface Annot {\n" +
10567
			"    ZZZ2 value();\n" +
10568
			"}");
10569
	
10570
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
10571
	String str = this.workingCopies[0].getSource();
10572
	String completeBehind = "ZZZ";
10573
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10574
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
10575
10576
	assertResults(
10577
			"ZZZ1[TYPE_REF]{p.ZZZ1, p, Lp.ZZZ1;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}\n" +
10578
			"ZZZ2[TYPE_REF]{p.ZZZ2, p, Lp.ZZZ2;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}",
10579
			requestor.getResults());
10580
}
10581
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158985
10582
public void test0329() throws JavaModelException {
10583
	this.workingCopies = new ICompilationUnit[4];
10584
	this.workingCopies[0] = getWorkingCopy(
10585
			"/Completion/src3/test/Test.java",
10586
			"package test;\n" +
10587
			"@ZZZ\n" +
10588
			"public class Test {\n" +
10589
			"}");
10590
	
10591
	this.workingCopies[1] = getWorkingCopy(
10592
			"/Completion/src3/p/ZZZ1.java",
10593
			"package p;\n" +
10594
			"@java.lang.annotation.Target({java.lang.annotation.ElementType.TYPE})\n" +
10595
			"public @interface ZZZ1 {\n" +
10596
			"}");
10597
	
10598
	this.workingCopies[1] = getWorkingCopy(
10599
			"/Completion/src3/p/ZZZ2.java",
10600
			"package p;\n" +
10601
			"@java.lang.annotation.Target({java.lang.annotation.ElementType.METHOD})\n" +
10602
			"public @interface ZZZ2 {\n" +
10603
			"}");
10604
	
10605
	this.workingCopies[2] = getWorkingCopy(
10606
			"/Completion/src3/p/ZZZ3.java",
10607
			"package p;\n" +
10608
			"public @interface ZZZ3 {\n" +
10609
			"}");
10610
	
10611
	
10612
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
10613
	String str = this.workingCopies[0].getSource();
10614
	String completeBehind = "ZZZ";
10615
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
10616
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
10617
10618
	assertResults(
10619
			"ZZZ1[TYPE_REF]{p.ZZZ1, p, Lp.ZZZ1;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}\n" +
10620
			"ZZZ3[TYPE_REF]{p.ZZZ3, p, Lp.ZZZ3;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}",
10621
			requestor.getResults());
10622
}
9440
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=153130
10623
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=153130
9441
public void testEC001() throws JavaModelException {
10624
public void testEC001() throws JavaModelException {
9442
	this.workingCopies = new ICompilationUnit[1];
10625
	this.workingCopies = new ICompilationUnit[1];
(-)codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java (-51 / +215 lines)
Lines 112-117 Link Here
112
	// K_BETWEEN_ANNOTATION_NAME_AND_RPAREN arguments
112
	// K_BETWEEN_ANNOTATION_NAME_AND_RPAREN arguments
113
	static final int LPAREN_NOT_CONSUMED = 1;
113
	static final int LPAREN_NOT_CONSUMED = 1;
114
	static final int LPAREN_CONSUMED = 2;
114
	static final int LPAREN_CONSUMED = 2;
115
	static final int ANNOTATION_NAME_COMPLETION = 4;
115
116
116
	// K_PARAMETERIZED_METHOD_INVOCATION arguments
117
	// K_PARAMETERIZED_METHOD_INVOCATION arguments
117
	static final int INSIDE_NAME = 1;
118
	static final int INSIDE_NAME = 1;
Lines 150-155 Link Here
150
	public int[] potentialVariableNameStarts;
151
	public int[] potentialVariableNameStarts;
151
	public int[] potentialVariableNameEnds;
152
	public int[] potentialVariableNameEnds;
152
	
153
	
154
	CompletionOnAnnotationOfType pendingAnnotation;
155
	
153
public CompletionParser(ProblemReporter problemReporter) {
156
public CompletionParser(ProblemReporter problemReporter) {
154
	super(problemReporter);
157
	super(problemReporter);
155
	this.reportSyntaxErrorIsRequired = false;
158
	this.reportSyntaxErrorIsRequired = false;
Lines 263-274 Link Here
263
				}
266
				}
264
267
265
				if(orphan instanceof Annotation) {
268
				if(orphan instanceof Annotation) {
266
					TypeDeclaration fakeType =
269
					CompletionOnAnnotationOfType fakeType =
267
						new CompletionOnAnnotationOfType(
270
						new CompletionOnAnnotationOfType(
268
								FAKE_TYPE_NAME,
271
								FAKE_TYPE_NAME,
269
								this.compilationUnit.compilationResult(),
272
								this.compilationUnit.compilationResult(),
270
								(Annotation)orphan);
273
								(Annotation)orphan);
271
					currentElement.parent.add(fakeType, 0);
274
					currentElement.parent.add(fakeType, 0);
275
					this.pendingAnnotation = fakeType;
272
					return;
276
					return;
273
				}
277
				}
274
			}
278
			}
Lines 280-292 Link Here
280
		}
284
		}
281
285
282
		if(orphan instanceof Annotation) {
286
		if(orphan instanceof Annotation) {
283
				TypeDeclaration fakeType =
287
			popUntilCompletedAnnotationIfNecessary();
284
					new CompletionOnAnnotationOfType(
288
			
285
							FAKE_TYPE_NAME,
289
			CompletionOnAnnotationOfType fakeType =
286
							this.compilationUnit.compilationResult(),
290
				new CompletionOnAnnotationOfType(
287
							(Annotation)orphan);
291
						FAKE_TYPE_NAME,
288
				currentElement.add(fakeType, 0);
292
						this.compilationUnit.compilationResult(),
289
				return;
293
						(Annotation)orphan);
294
			currentElement.add(fakeType, 0);
295
			
296
			if (!isInsideAnnotation()) {
297
				this.pendingAnnotation = fakeType;
298
			}
299
			
300
			return;
290
		}
301
		}
291
302
292
		if ((topKnownElementKind(COMPLETION_OR_ASSIST_PARSER) == K_BETWEEN_CATCH_AND_RIGHT_PAREN)) {
303
		if ((topKnownElementKind(COMPLETION_OR_ASSIST_PARSER) == K_BETWEEN_CATCH_AND_RIGHT_PAREN)) {
Lines 597-609 Link Here
597
		annotation.memberValuePairs = memberValuePairs;
608
		annotation.memberValuePairs = memberValuePairs;
598
609
599
	}
610
	}
600
	TypeDeclaration fakeType =
611
	CompletionOnAnnotationOfType fakeType =
601
		new CompletionOnAnnotationOfType(
612
		new CompletionOnAnnotationOfType(
602
				FAKE_TYPE_NAME,
613
				FAKE_TYPE_NAME,
603
				this.compilationUnit.compilationResult(),
614
				this.compilationUnit.compilationResult(),
604
				annotation);
615
				annotation);
605
616
606
	currentElement.add(fakeType, 0);
617
	currentElement.add(fakeType, 0);
618
	this.pendingAnnotation = fakeType;
607
}
619
}
608
private void buildMoreCompletionContext(Expression expression) {
620
private void buildMoreCompletionContext(Expression expression) {
609
	Statement statement = expression;
621
	Statement statement = expression;
Lines 1892-1897 Link Here
1892
protected void consumeClassBodyDeclaration() {
1904
protected void consumeClassBodyDeclaration() {
1893
	popElement(K_BLOCK_DELIMITER);
1905
	popElement(K_BLOCK_DELIMITER);
1894
	super.consumeClassBodyDeclaration();
1906
	super.consumeClassBodyDeclaration();
1907
	this.pendingAnnotation = null; // the pending annotation cannot be attached to next nodes
1895
}
1908
}
1896
protected void consumeClassBodyopt() {
1909
protected void consumeClassBodyopt() {
1897
	popElement(K_SELECTOR_QUALIFIER);
1910
	popElement(K_SELECTOR_QUALIFIER);
Lines 1919-1925 Link Here
1919
}
1932
}
1920
protected void consumeClassHeaderName1() {
1933
protected void consumeClassHeaderName1() {
1921
	super.consumeClassHeaderName1();
1934
	super.consumeClassHeaderName1();
1922
1935
	if (this.pendingAnnotation != null) {
1936
		this.pendingAnnotation.potentialAnnotatedNode = this.astStack[this.astPtr];
1937
		this.pendingAnnotation = null;
1938
	}
1923
	classHeaderExtendsOrImplements(false);
1939
	classHeaderExtendsOrImplements(false);
1924
}
1940
}
1925
1941
Lines 2002-2008 Link Here
2002
2018
2003
	/* no need to take action if not inside assist identifiers */
2019
	/* no need to take action if not inside assist identifiers */
2004
	if (indexOfAssistIdentifier() < 0) {
2020
	if (indexOfAssistIdentifier() < 0) {
2005
		super.consumeConstructorHeaderName();
2021
		/* recovering - might be an empty message send */
2022
		if (this.currentElement != null && this.lastIgnoredToken == TokenNamenew){ // was an allocation expression
2023
			super.consumeConstructorHeaderName();
2024
		} else {
2025
			super.consumeConstructorHeaderName();
2026
			if (this.pendingAnnotation != null) {
2027
				this.pendingAnnotation.potentialAnnotatedNode = this.astStack[this.astPtr];
2028
				this.pendingAnnotation = null;
2029
			}
2030
		}
2006
		return;
2031
		return;
2007
	}
2032
	}
2008
2033
Lines 2014-2019 Link Here
2014
	pushOnGenericsLengthStack(0); // handle type arguments
2039
	pushOnGenericsLengthStack(0); // handle type arguments
2015
	this.restartRecovery = true;
2040
	this.restartRecovery = true;
2016
}
2041
}
2042
protected void consumeConstructorHeaderNameWithTypeParameters() {
2043
	if (this.currentElement != null && this.lastIgnoredToken == TokenNamenew){ // was an allocation expression
2044
		super.consumeConstructorHeaderNameWithTypeParameters();
2045
	} else {
2046
		super.consumeConstructorHeaderNameWithTypeParameters();
2047
		if (this.pendingAnnotation != null) {
2048
			this.pendingAnnotation.potentialAnnotatedNode = this.astStack[this.astPtr];
2049
			this.pendingAnnotation = null;
2050
		}
2051
	}
2052
}
2017
protected void consumeDefaultLabel() {
2053
protected void consumeDefaultLabel() {
2018
	super.consumeDefaultLabel();
2054
	super.consumeDefaultLabel();
2019
	if(topKnownElementKind(COMPLETION_OR_ASSIST_PARSER) == K_SWITCH_LABEL) {
2055
	if(topKnownElementKind(COMPLETION_OR_ASSIST_PARSER) == K_SWITCH_LABEL) {
Lines 2025-2030 Link Here
2025
	// DimWithOrWithOutExpr ::= '[' ']'
2061
	// DimWithOrWithOutExpr ::= '[' ']'
2026
	pushOnExpressionStack(null);
2062
	pushOnExpressionStack(null);
2027
}
2063
}
2064
protected void consumeEnhancedForStatementHeaderInit(boolean hasModifiers) {
2065
	super.consumeEnhancedForStatementHeaderInit(hasModifiers);
2066
	if (this.pendingAnnotation != null) {
2067
		this.pendingAnnotation.potentialAnnotatedNode = this.astStack[this.astPtr];
2068
		this.pendingAnnotation = null;
2069
	}
2070
}
2028
protected void consumeEnterAnonymousClassBody() {
2071
protected void consumeEnterAnonymousClassBody() {
2029
	popElement(K_SELECTOR_QUALIFIER);
2072
	popElement(K_SELECTOR_QUALIFIER);
2030
	popElement(K_SELECTOR_INVOCATION_TYPE);
2073
	popElement(K_SELECTOR_INVOCATION_TYPE);
Lines 2041-2083 Link Here
2041
	if(isLocalDeclaration || indexOfAssistIdentifier() < 0 || variableIndex != 0 || extendedDimension != 0) {
2084
	if(isLocalDeclaration || indexOfAssistIdentifier() < 0 || variableIndex != 0 || extendedDimension != 0) {
2042
		identifierPtr++;
2085
		identifierPtr++;
2043
		identifierLengthPtr++;
2086
		identifierLengthPtr++;
2044
		super.consumeEnterVariable();
2087
		
2088
		if (this.pendingAnnotation != null &&
2089
				this.assistNode != null &&
2090
				this.currentElement != null &&
2091
				this.currentElement instanceof RecoveredMethod &&
2092
				!this.currentElement.foundOpeningBrace &&
2093
				((RecoveredMethod)this.currentElement).methodDeclaration.declarationSourceEnd == 0) {
2094
			// this is a method parameter
2095
			super.consumeEnterVariable();
2096
			this.pendingAnnotation.potentialAnnotatedNode = this.astStack[this.astPtr];
2097
			this.pendingAnnotation.isParameter = true;
2098
			this.pendingAnnotation = null;
2099
			
2100
		} else {
2101
			super.consumeEnterVariable();
2102
			if (this.pendingAnnotation != null) {
2103
				this.pendingAnnotation.potentialAnnotatedNode = this.astStack[this.astPtr];
2104
				this.pendingAnnotation = null;
2105
			}
2106
		}
2045
	} else {
2107
	} else {
2046
		restartRecovery = true;
2108
		restartRecovery = true;
2047
2109
2048
//		private boolean checkKeyword() {
2049
//			if (currentElement instanceof RecoveredUnit) {
2050
//				RecoveredUnit unit = (RecoveredUnit) currentElement;
2051
//				int index = -1;
2052
//				if ((index = this.indexOfAssistIdentifier()) > -1) {
2053
//					if(unit.typeCount == 0
2054
//						&& CharOperation.prefixEquals(identifierStack[index], Keywords.IMPORT)) {
2055
//						CompletionOnKeyword2 completionOnImportKeyword = new CompletionOnKeyword2(Keywords.IMPORT, identifierPositionStack[index]);
2056
//						this.assistNode = completionOnImportKeyword;
2057
//						this.lastCheckPoint = completionOnImportKeyword.sourceEnd + 1;
2058
//						this.isOrphanCompletionNode = true;
2059
//						return true;
2060
//					} else if(unit.typeCount == 0
2061
//						&& unit.importCount == 0
2062
//						&& CharOperation.prefixEquals(identifierStack[index], Keywords.PACKAGE)) {
2063
//						CompletionOnKeyword2 completionOnImportKeyword = new CompletionOnKeyword2(Keywords.PACKAGE, identifierPositionStack[index]);
2064
//						this.assistNode = completionOnImportKeyword;
2065
//						this.lastCheckPoint = completionOnImportKeyword.sourceEnd + 1;
2066
//						this.isOrphanCompletionNode = true;
2067
//						return true;
2068
//					}
2069
//				}
2070
//			}
2071
//			return false;
2072
//		}
2073
2074
		// recovery
2110
		// recovery
2075
		if (currentElement != null) {
2111
		if (currentElement != null) {
2076
			if(!checkKeyword() && !(currentElement instanceof RecoveredUnit && ((RecoveredUnit)currentElement).typeCount == 0)) {
2112
			if(!checkKeyword() && !(currentElement instanceof RecoveredUnit && ((RecoveredUnit)currentElement).typeCount == 0)) {
2077
				int nameSourceStart = (int)(identifierPositionStack[identifierPtr] >>> 32);
2113
				int nameSourceStart = (int)(identifierPositionStack[identifierPtr] >>> 32);
2078
				intPtr--;
2114
				intPtr--;
2079
//				pushOnGenericsIdentifiersLengthStack(identifierLengthStack[identifierLengthPtr]);
2080
//				pushOnGenericsLengthStack(0);
2081
				TypeReference type = getTypeReference(intStack[intPtr--]);
2115
				TypeReference type = getTypeReference(intStack[intPtr--]);
2082
				intPtr--;
2116
				intPtr--;
2083
2117
Lines 2100-2105 Link Here
2100
		}
2134
		}
2101
	}
2135
	}
2102
}
2136
}
2137
protected void consumeEnumConstantHeaderName() {
2138
	if (this.currentElement != null) {
2139
		if (!(this.currentElement instanceof RecoveredType
2140
					|| (this.currentElement instanceof RecoveredField && ((RecoveredField)currentElement).fieldDeclaration.type == null))
2141
				|| (this.lastIgnoredToken == TokenNameDOT)) {
2142
			super.consumeEnumConstantHeaderName();
2143
			return;
2144
		}
2145
	}
2146
	super.consumeEnumConstantHeaderName();
2147
	if (this.pendingAnnotation != null) {
2148
		this.pendingAnnotation.potentialAnnotatedNode = this.astStack[this.astPtr];
2149
		this.pendingAnnotation = null;
2150
	}
2151
}
2152
protected void consumeEnumHeaderName() {
2153
	super.consumeEnumHeaderName();
2154
	if (this.pendingAnnotation != null) {
2155
		this.pendingAnnotation.potentialAnnotatedNode = this.astStack[this.astPtr];
2156
		this.pendingAnnotation = null;
2157
	}
2158
}
2103
protected void consumeEqualityExpression(int op) {
2159
protected void consumeEqualityExpression(int op) {
2104
	super.consumeEqualityExpression(op);
2160
	super.consumeEqualityExpression(op);
2105
	popElement(K_BINARY_OPERATOR);
2161
	popElement(K_BINARY_OPERATOR);
Lines 2163-2168 Link Here
2163
protected void consumeFormalParameter(boolean isVarArgs) {
2219
protected void consumeFormalParameter(boolean isVarArgs) {
2164
	if (this.indexOfAssistIdentifier() < 0) {
2220
	if (this.indexOfAssistIdentifier() < 0) {
2165
		super.consumeFormalParameter(isVarArgs);
2221
		super.consumeFormalParameter(isVarArgs);
2222
		if (this.pendingAnnotation != null) {
2223
			this.pendingAnnotation.potentialAnnotatedNode = this.astStack[this.astPtr];
2224
			this.pendingAnnotation = null;
2225
		}
2166
	} else {
2226
	} else {
2167
2227
2168
		identifierLengthPtr--;
2228
		identifierLengthPtr--;
Lines 2298-2304 Link Here
2298
}
2358
}
2299
protected void consumeInterfaceHeaderName1() {
2359
protected void consumeInterfaceHeaderName1() {
2300
	super.consumeInterfaceHeaderName1();
2360
	super.consumeInterfaceHeaderName1();
2301
2361
	if (this.pendingAnnotation != null) {
2362
		this.pendingAnnotation.potentialAnnotatedNode = this.astStack[this.astPtr];
2363
		this.pendingAnnotation = null;
2364
	}
2302
	classHeaderExtendsOrImplements(true);
2365
	classHeaderExtendsOrImplements(true);
2303
}
2366
}
2304
protected void consumeInterfaceHeaderExtends() {
2367
protected void consumeInterfaceHeaderExtends() {
Lines 2349-2354 Link Here
2349
			identifierPtr++;
2412
			identifierPtr++;
2350
			identifierLengthPtr++;
2413
			identifierLengthPtr++;
2351
			super.consumeMethodHeaderName(isAnnotationMethod);
2414
			super.consumeMethodHeaderName(isAnnotationMethod);
2415
			if (this.pendingAnnotation != null) {
2416
				this.pendingAnnotation.potentialAnnotatedNode = this.astStack[this.astPtr];
2417
				this.pendingAnnotation = null;
2418
			}
2352
		} else {
2419
		} else {
2353
			restartRecovery = true;
2420
			restartRecovery = true;
2354
2421
Lines 2463-2468 Link Here
2463
		}
2530
		}
2464
	}
2531
	}
2465
}
2532
}
2533
protected void consumeMethodHeaderNameWithTypeParameters( boolean isAnnotationMethod) {
2534
	super.consumeMethodHeaderNameWithTypeParameters(isAnnotationMethod);
2535
	if (this.pendingAnnotation != null) {
2536
		this.pendingAnnotation.potentialAnnotatedNode = this.astStack[this.astPtr];
2537
		this.pendingAnnotation = null;
2538
	}
2539
}
2466
protected void consumeMethodHeaderRightParen() {
2540
protected void consumeMethodHeaderRightParen() {
2467
	super.consumeMethodHeaderRightParen();
2541
	super.consumeMethodHeaderRightParen();
2468
2542
Lines 2576-2584 Link Here
2576
2650
2577
	assistNode = markerAnnotation;
2651
	assistNode = markerAnnotation;
2578
	this.isOrphanCompletionNode = true;
2652
	this.isOrphanCompletionNode = true;
2579
	this.restartRecovery = true;
2580
2653
2581
	this.lastCheckPoint = markerAnnotation.sourceEnd + 1;
2654
	this.lastCheckPoint = markerAnnotation.sourceEnd + 1;
2655
	
2656
	this.pushOnElementStack(K_BETWEEN_ANNOTATION_NAME_AND_RPAREN, LPAREN_NOT_CONSUMED | ANNOTATION_NAME_COMPLETION);
2657
}
2658
protected void consumeAnnotationTypeDeclarationHeaderName() {
2659
	super.consumeAnnotationTypeDeclarationHeaderName();
2660
	if (this.pendingAnnotation != null) {
2661
		this.pendingAnnotation.potentialAnnotatedNode = this.astStack[this.astPtr];
2662
		this.pendingAnnotation = null;
2663
	}
2582
}
2664
}
2583
protected void consumeLabel() {
2665
protected void consumeLabel() {
2584
	super.consumeLabel();
2666
	super.consumeLabel();
Lines 2586-2593 Link Here
2586
	this.pushOnElementStack(K_LABEL, this.labelPtr);
2668
	this.pushOnElementStack(K_LABEL, this.labelPtr);
2587
}
2669
}
2588
protected void consumeMarkerAnnotation() {
2670
protected void consumeMarkerAnnotation() {
2589
	this.popElement(K_BETWEEN_ANNOTATION_NAME_AND_RPAREN);
2671
	if (this.topKnownElementKind(COMPLETION_OR_ASSIST_PARSER) == K_BETWEEN_ANNOTATION_NAME_AND_RPAREN &&
2590
	super.consumeMarkerAnnotation();
2672
			(this.topKnownElementInfo(COMPLETION_OR_ASSIST_PARSER) & ANNOTATION_NAME_COMPLETION) != 0 ) {
2673
		this.popElement(K_BETWEEN_ANNOTATION_NAME_AND_RPAREN);
2674
		this.restartRecovery = true;
2675
	} else {
2676
		this.popElement(K_BETWEEN_ANNOTATION_NAME_AND_RPAREN);
2677
		super.consumeMarkerAnnotation();
2678
	}
2591
}
2679
}
2592
protected void consumeMemberValuePair() {
2680
protected void consumeMemberValuePair() {
2593
	/* check if current awaiting identifier is the completion identifier */
2681
	/* check if current awaiting identifier is the completion identifier */
Lines 2656-2663 Link Here
2656
	}
2744
	}
2657
}
2745
}
2658
protected void consumeSingleMemberAnnotation() {
2746
protected void consumeSingleMemberAnnotation() {
2659
	this.popElement(K_BETWEEN_ANNOTATION_NAME_AND_RPAREN);
2747
	if (this.topKnownElementKind(COMPLETION_OR_ASSIST_PARSER) == K_BETWEEN_ANNOTATION_NAME_AND_RPAREN &&
2660
	super.consumeSingleMemberAnnotation();
2748
			(this.topKnownElementInfo(COMPLETION_OR_ASSIST_PARSER) & ANNOTATION_NAME_COMPLETION) != 0 ) {
2749
		this.popElement(K_BETWEEN_ANNOTATION_NAME_AND_RPAREN);
2750
		this.restartRecovery = true;
2751
	} else {
2752
		this.popElement(K_BETWEEN_ANNOTATION_NAME_AND_RPAREN);
2753
		super.consumeSingleMemberAnnotation();
2754
	}
2755
}
2756
protected void consumeSingleStaticImportDeclarationName() {
2757
	super.consumeSingleStaticImportDeclarationName();
2758
	this.pendingAnnotation = null; // the pending annotation cannot be attached to next nodes
2759
}
2760
protected void consumeSingleTypeImportDeclarationName() {
2761
	super.consumeSingleTypeImportDeclarationName();
2762
	this.pendingAnnotation = null; // the pending annotation cannot be attached to next nodes
2661
}
2763
}
2662
protected void consumeStatementBreakWithLabel() {
2764
protected void consumeStatementBreakWithLabel() {
2663
	super.consumeStatementBreakWithLabel();
2765
	super.consumeStatementBreakWithLabel();
Lines 2680-2692 Link Here
2680
		popElement(K_BLOCK_DELIMITER);
2782
		popElement(K_BLOCK_DELIMITER);
2681
	}
2783
	}
2682
}
2784
}
2785
protected void consumeStaticImportOnDemandDeclarationName() {
2786
	super.consumeStaticImportOnDemandDeclarationName();
2787
	this.pendingAnnotation = null; // the pending annotation cannot be attached to next nodes
2788
}
2789
protected void consumeStaticInitializer() {
2790
	super.consumeStaticInitializer();
2791
	this.pendingAnnotation = null; // the pending annotation cannot be attached to next nodes
2792
}
2683
protected void consumeNestedMethod() {
2793
protected void consumeNestedMethod() {
2684
	super.consumeNestedMethod();
2794
	super.consumeNestedMethod();
2685
	if(!(topKnownElementKind(COMPLETION_OR_ASSIST_PARSER) == K_BLOCK_DELIMITER)) pushOnElementStack(K_BLOCK_DELIMITER);
2795
	if(!(topKnownElementKind(COMPLETION_OR_ASSIST_PARSER) == K_BLOCK_DELIMITER)) pushOnElementStack(K_BLOCK_DELIMITER);
2686
}
2796
}
2687
protected void consumeNormalAnnotation() {
2797
protected void consumeNormalAnnotation() {
2688
	this.popElement(K_BETWEEN_ANNOTATION_NAME_AND_RPAREN);
2798
	if (this.topKnownElementKind(COMPLETION_OR_ASSIST_PARSER) == K_BETWEEN_ANNOTATION_NAME_AND_RPAREN &&
2689
	super.consumeNormalAnnotation();
2799
			(this.topKnownElementInfo(COMPLETION_OR_ASSIST_PARSER) & ANNOTATION_NAME_COMPLETION) != 0 ) {
2800
		this.popElement(K_BETWEEN_ANNOTATION_NAME_AND_RPAREN);
2801
		this.restartRecovery = true;
2802
	} else {
2803
		this.popElement(K_BETWEEN_ANNOTATION_NAME_AND_RPAREN);
2804
		super.consumeNormalAnnotation();
2805
	}
2806
}
2807
protected void consumePackageDeclarationName() {
2808
	super.consumePackageDeclarationName();
2809
	if (this.pendingAnnotation != null) {
2810
		this.pendingAnnotation.potentialAnnotatedNode = this.compilationUnit.currentPackage;
2811
		this.pendingAnnotation = null;
2812
	}
2813
}
2814
protected void consumePackageDeclarationNameWithModifiers() {
2815
	super.consumePackageDeclarationNameWithModifiers();
2816
	if (this.pendingAnnotation != null) {
2817
		this.pendingAnnotation.potentialAnnotatedNode = this.compilationUnit.currentPackage;
2818
		this.pendingAnnotation = null;
2819
	}
2690
}
2820
}
2691
protected void consumePrimaryNoNewArrayName() {
2821
protected void consumePrimaryNoNewArrayName() {
2692
	// this is class literal access, so reset potential receiver
2822
	// this is class literal access, so reset potential receiver
Lines 2849-2859 Link Here
2849
				switch (previous) {
2979
				switch (previous) {
2850
					case TokenNameIdentifier: // eg. fred[(]) or foo.fred[(])
2980
					case TokenNameIdentifier: // eg. fred[(]) or foo.fred[(])
2851
						if (topKnownElementKind(COMPLETION_OR_ASSIST_PARSER) == K_SELECTOR) {
2981
						if (topKnownElementKind(COMPLETION_OR_ASSIST_PARSER) == K_SELECTOR) {
2982
							int info = 0;
2852
							if(topKnownElementKind(COMPLETION_OR_ASSIST_PARSER,1) == K_BETWEEN_ANNOTATION_NAME_AND_RPAREN &&
2983
							if(topKnownElementKind(COMPLETION_OR_ASSIST_PARSER,1) == K_BETWEEN_ANNOTATION_NAME_AND_RPAREN &&
2853
									topKnownElementInfo(COMPLETION_OR_ASSIST_PARSER,1) == LPAREN_NOT_CONSUMED) {
2984
									(info=topKnownElementInfo(COMPLETION_OR_ASSIST_PARSER,1) & LPAREN_NOT_CONSUMED) != 0) {
2854
								this.popElement(K_SELECTOR);
2985
								this.popElement(K_SELECTOR);
2855
								this.popElement(K_BETWEEN_ANNOTATION_NAME_AND_RPAREN);
2986
								this.popElement(K_BETWEEN_ANNOTATION_NAME_AND_RPAREN);
2856
								this.pushOnElementStack(K_BETWEEN_ANNOTATION_NAME_AND_RPAREN, LPAREN_CONSUMED);
2987
								if ((info & ANNOTATION_NAME_COMPLETION) != 0) {
2988
									this.pushOnElementStack(K_BETWEEN_ANNOTATION_NAME_AND_RPAREN, LPAREN_CONSUMED | ANNOTATION_NAME_COMPLETION);
2989
								} else {
2990
									this.pushOnElementStack(K_BETWEEN_ANNOTATION_NAME_AND_RPAREN, LPAREN_CONSUMED);
2991
								}
2857
							} else {
2992
							} else {
2858
								this.pushOnElementStack(K_SELECTOR_INVOCATION_TYPE, this.invocationType);
2993
								this.pushOnElementStack(K_SELECTOR_INVOCATION_TYPE, this.invocationType);
2859
								this.pushOnElementStack(K_SELECTOR_QUALIFIER, this.qualifier);
2994
								this.pushOnElementStack(K_SELECTOR_QUALIFIER, this.qualifier);
Lines 3238-3243 Link Here
3238
	TypeDeclaration typeDecl = (TypeDeclaration)this.astStack[this.astPtr];
3373
	TypeDeclaration typeDecl = (TypeDeclaration)this.astStack[this.astPtr];
3239
	classHeaderExtendsOrImplements((typeDecl.modifiers & ClassFileConstants.AccInterface) != 0);
3374
	classHeaderExtendsOrImplements((typeDecl.modifiers & ClassFileConstants.AccInterface) != 0);
3240
}
3375
}
3376
protected void consumeTypeImportOnDemandDeclarationName() {
3377
	super.consumeTypeImportOnDemandDeclarationName();
3378
	this.pendingAnnotation = null; // the pending annotation cannot be attached to next nodes
3379
}
3241
protected void consumeTypeParameters() {
3380
protected void consumeTypeParameters() {
3242
	super.consumeTypeParameters();
3381
	super.consumeTypeParameters();
3243
	popElement(K_BINARY_OPERATOR);
3382
	popElement(K_BINARY_OPERATOR);
Lines 3780-3785 Link Here
3780
	}
3919
	}
3781
	return false;
3920
	return false;
3782
}
3921
}
3922
3783
protected boolean isIndirectlyInsideBlock(){
3923
protected boolean isIndirectlyInsideBlock(){
3784
	int i = elementPtr;
3924
	int i = elementPtr;
3785
	while(i > -1) {
3925
	while(i > -1) {
Lines 3919-3924 Link Here
3919
4059
3920
	return fakeMethod;
4060
	return fakeMethod;
3921
}
4061
}
4062
protected void popUntilCompletedAnnotationIfNecessary() {
4063
	if(elementPtr < 0) return;
4064
	
4065
	int i = elementPtr;
4066
	while(i > -1 &&
4067
			(elementKindStack[i] != K_BETWEEN_ANNOTATION_NAME_AND_RPAREN ||
4068
					(elementInfoStack[i] & ANNOTATION_NAME_COMPLETION) == 0)) {
4069
		i--;
4070
	}
4071
	
4072
	if(i >= 0) {
4073
		previousKind = elementKindStack[i];
4074
		previousInfo = elementInfoStack[i];
4075
		elementPtr = i - 1;	
4076
	}
4077
}
3922
/*
4078
/*
3923
 * Prepares the state of the parser to go for BlockStatements.
4079
 * Prepares the state of the parser to go for BlockStatements.
3924
 */
4080
 */
Lines 4012-4017 Link Here
4012
public void recoveryTokenCheck() {
4168
public void recoveryTokenCheck() {
4013
	RecoveredElement oldElement = currentElement;
4169
	RecoveredElement oldElement = currentElement;
4014
	switch (currentToken) {
4170
	switch (currentToken) {
4171
		case TokenNameLBRACE :
4172
			if(!this.ignoreNextOpeningBrace) {
4173
				this.pendingAnnotation = null; // the pending annotation cannot be attached to next nodes
4174
			}
4175
			super.recoveryTokenCheck();
4176
			break;
4015
		case TokenNameRBRACE :
4177
		case TokenNameRBRACE :
4016
			super.recoveryTokenCheck();
4178
			super.recoveryTokenCheck();
4017
			if(currentElement != oldElement && oldElement instanceof RecoveredBlock) {
4179
			if(currentElement != oldElement && oldElement instanceof RecoveredBlock) {
Lines 4099-4105 Link Here
4099
			/* restart in diet mode for finding sibling constructs */
4261
			/* restart in diet mode for finding sibling constructs */
4100
			if (currentElement instanceof RecoveredType
4262
			if (currentElement instanceof RecoveredType
4101
				|| currentElement.enclosingType() != null){
4263
				|| currentElement.enclosingType() != null){
4102
4264
					
4265
				this.pendingAnnotation = null;
4266
				
4103
				if(lastCheckPoint <= this.assistNode.sourceEnd) {
4267
				if(lastCheckPoint <= this.assistNode.sourceEnd) {
4104
					lastCheckPoint = this.assistNode.sourceEnd+1;
4268
					lastCheckPoint = this.assistNode.sourceEnd+1;
4105
				}
4269
				}
(-)codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnAnnotationOfType.java (+6 lines)
Lines 11-20 Link Here
11
package org.eclipse.jdt.internal.codeassist.complete;
11
package org.eclipse.jdt.internal.codeassist.complete;
12
12
13
import org.eclipse.jdt.internal.compiler.CompilationResult;
13
import org.eclipse.jdt.internal.compiler.CompilationResult;
14
import org.eclipse.jdt.internal.compiler.ast.ASTNode;
14
import org.eclipse.jdt.internal.compiler.ast.Annotation;
15
import org.eclipse.jdt.internal.compiler.ast.Annotation;
15
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
16
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
16
17
17
public class CompletionOnAnnotationOfType extends TypeDeclaration {
18
public class CompletionOnAnnotationOfType extends TypeDeclaration {
19
	public ASTNode potentialAnnotatedNode;
20
	// During recovery a parameter can be parsed as a FieldDeclaration instead of Argument.
21
	// 'isParameter' is set to true in this case.
22
	public boolean isParameter;
23
	
18
	public CompletionOnAnnotationOfType(char[] typeName, CompilationResult compilationResult, Annotation annotation){
24
	public CompletionOnAnnotationOfType(char[] typeName, CompilationResult compilationResult, Annotation annotation){
19
		super(compilationResult);
25
		super(compilationResult);
20
		this.sourceEnd = annotation.sourceEnd;
26
		this.sourceEnd = annotation.sourceEnd;
(-)codeassist/org/eclipse/jdt/internal/codeassist/RelevanceConstants.java (+1 lines)
Lines 42-45 Link Here
42
	int R_NON_INHERITED = 2;
42
	int R_NON_INHERITED = 2;
43
	int R_NO_PROBLEMS = 1;
43
	int R_NO_PROBLEMS = 1;
44
	int R_RESOLVED = 1;
44
	int R_RESOLVED = 1;
45
	int R_TARGET = 5;
45
}
46
}
(-)codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java (-11 / +129 lines)
Lines 255-260 Link Here
255
	int  assistNodeInJavadoc = 0;
255
	int  assistNodeInJavadoc = 0;
256
	boolean assistNodeCanBeSingleMemberAnnotation = false;
256
	boolean assistNodeCanBeSingleMemberAnnotation = false;
257
	
257
	
258
	long targetedElement;
259
	
258
	IJavaProject javaProject;
260
	IJavaProject javaProject;
259
	CompletionParser parser;
261
	CompletionParser parser;
260
	CompletionRequestor requestor;
262
	CompletionRequestor requestor;
Lines 436-442 Link Here
436
		acceptedTypes.add(new AcceptedType(packageName, simpleTypeName, enclosingTypeNames, modifiers, accessibility));
438
		acceptedTypes.add(new AcceptedType(packageName, simpleTypeName, enclosingTypeNames, modifiers, accessibility));
437
	}
439
	}
438
	
440
	
439
	private void acceptTypes() {
441
	private void acceptTypes(Scope scope) {
440
		if(this.acceptedTypes == null) return;
442
		if(this.acceptedTypes == null) return;
441
		
443
		
442
		int length = this.acceptedTypes.size();
444
		int length = this.acceptedTypes.size();
Lines 512-518 Link Here
512
								accessibility,
514
								accessibility,
513
								typeName,
515
								typeName,
514
								fullyQualifiedName,
516
								fullyQualifiedName,
515
								!CharOperation.equals(fullyQualifiedName, importName[1]));
517
								!CharOperation.equals(fullyQualifiedName, importName[1]),
518
								scope);
516
						continue next;
519
						continue next;
517
					}
520
					}
518
				}
521
				}
Lines 526-532 Link Here
526
							accessibility,
529
							accessibility,
527
							typeName,
530
							typeName,
528
							fullyQualifiedName,
531
							fullyQualifiedName,
529
							false);
532
							false,
533
							scope);
530
					continue next;
534
					continue next;
531
				} else {
535
				} else {
532
					char[] fullyQualifiedEnclosingTypeOrPackageName = null;
536
					char[] fullyQualifiedEnclosingTypeOrPackageName = null;
Lines 610-616 Link Here
610
							accessibility,
614
							accessibility,
611
							typeName,
615
							typeName,
612
							fullyQualifiedName,
616
							fullyQualifiedName,
613
							true);
617
							true,
618
							scope);
614
				}
619
				}
615
			}
620
			}
616
		}
621
		}
Lines 628-634 Link Here
628
							value.accessibility,
633
							value.accessibility,
629
							value.qualifiedTypeName,
634
							value.qualifiedTypeName,
630
							value.fullyQualifiedName,
635
							value.fullyQualifiedName,
631
							value.mustBeQualified);
636
							value.mustBeQualified,
637
							scope);
632
				}
638
				}
633
			}
639
			}
634
		}
640
		}
Lines 691-697 Link Here
691
		return true;
697
		return true;
692
	}
698
	}
693
	
699
	
694
	private void proposeType(char[] packageName, char[] simpleTypeName, int modifiers, int accessibility, char[] typeName, char[] fullyQualifiedName, boolean isQualified) {
700
	private void proposeType(char[] packageName, char[] simpleTypeName, int modifiers, int accessibility, char[] typeName, char[] fullyQualifiedName, boolean isQualified, Scope scope) {
695
		char[] completionName = fullyQualifiedName;
701
		char[] completionName = fullyQualifiedName;
696
		if(isQualified) {
702
		if(isQualified) {
697
			if (packageName == null || packageName.length == 0)
703
			if (packageName == null || packageName.length == 0)
Lines 700-705 Link Here
700
		} else {
706
		} else {
701
			completionName = simpleTypeName;
707
			completionName = simpleTypeName;
702
		}
708
		}
709
		
710
		TypeBinding guessedType = null;
711
		if ((modifiers & ClassFileConstants.AccAnnotation) != 0 &&
712
				this.assistNodeIsAnnotation &&
713
				(this.targetedElement & TagBits.AnnotationTargetMASK) != 0) {
714
			char[][] cn = CharOperation.splitOn('.', fullyQualifiedName);
715
			
716
			TypeReference ref;
717
			if (cn.length == 1) {
718
				ref = new SingleTypeReference(simpleTypeName, 0);
719
			} else {
720
				ref = new QualifiedTypeReference(cn,new long[cn.length]);
721
			}
722
			
723
			switch (scope.kind) {
724
				case Scope.METHOD_SCOPE :
725
				case Scope.BLOCK_SCOPE :
726
					guessedType = ref.resolveType((BlockScope)scope);
727
					break;
728
				case Scope.CLASS_SCOPE :
729
					guessedType = ref.resolveType((ClassScope)scope);
730
					break;
731
			}
732
			
733
			if (!guessedType.isValidBinding()) return;
734
			
735
			if (!hasPossibleAnnotationTarget(guessedType, scope)) return;
736
		}
703
737
704
		int relevance = computeBaseRelevance();
738
		int relevance = computeBaseRelevance();
705
		relevance += computeRelevanceForResolution();
739
		relevance += computeRelevanceForResolution();
Lines 714-719 Link Here
714
			case ClassFileConstants.AccAnnotation:
748
			case ClassFileConstants.AccAnnotation:
715
			case ClassFileConstants.AccAnnotation | ClassFileConstants.AccInterface:
749
			case ClassFileConstants.AccAnnotation | ClassFileConstants.AccInterface:
716
				relevance += computeRelevanceForAnnotation();
750
				relevance += computeRelevanceForAnnotation();
751
				if (guessedType != null) relevance += computeRelevanceForAnnotationTarget(guessedType);
717
				relevance += computeRelevanceForInterface();
752
				relevance += computeRelevanceForInterface();
718
				break;
753
				break;
719
			case ClassFileConstants.AccEnum:
754
			case ClassFileConstants.AccEnum:
Lines 1428-1433 Link Here
1428
		} else if (astNode instanceof CompletionOnMarkerAnnotationName) {
1463
		} else if (astNode instanceof CompletionOnMarkerAnnotationName) {
1429
			CompletionOnMarkerAnnotationName annot = (CompletionOnMarkerAnnotationName) astNode;
1464
			CompletionOnMarkerAnnotationName annot = (CompletionOnMarkerAnnotationName) astNode;
1430
			
1465
			
1466
			CompletionOnAnnotationOfType fakeType = (CompletionOnAnnotationOfType)scope.parent.referenceContext();
1467
			if (fakeType.annotations[0] == annot) {
1468
				// When the completion is inside a method body the annotation cannot be accuratly attached to the correct node by completion recovery.
1469
				// So 'targetedElement' is not computed in this case.
1470
				if (scope.parent.parent == null || !(scope.parent.parent instanceof MethodScope)) {
1471
					this.targetedElement = computeTargetedElement(fakeType);
1472
				}
1473
				
1474
			}
1475
			
1431
			this.assistNodeIsAnnotation = true;
1476
			this.assistNodeIsAnnotation = true;
1432
			if (annot.type instanceof CompletionOnSingleTypeReference) {
1477
			if (annot.type instanceof CompletionOnSingleTypeReference) {
1433
				CompletionOnSingleTypeReference type = (CompletionOnSingleTypeReference) annot.type;
1478
				CompletionOnSingleTypeReference type = (CompletionOnSingleTypeReference) annot.type;
Lines 2110-2115 Link Here
2110
		}
2155
		}
2111
	}
2156
	}
2112
2157
2158
	private long computeTargetedElement(CompletionOnAnnotationOfType fakeNode) {
2159
		ASTNode annotatedElement = fakeNode.potentialAnnotatedNode;
2160
		
2161
		if (annotatedElement instanceof TypeDeclaration) {
2162
			TypeDeclaration annotatedTypeDeclaration = (TypeDeclaration) annotatedElement;
2163
			if (TypeDeclaration.kind(annotatedTypeDeclaration.modifiers) == TypeDeclaration.ANNOTATION_TYPE_DECL) {
2164
				return TagBits.AnnotationForAnnotationType | TagBits.AnnotationForType;
2165
			}
2166
			return TagBits.AnnotationForType;
2167
		} else if (annotatedElement instanceof FieldDeclaration) {
2168
			if (fakeNode.isParameter) {
2169
				return TagBits.AnnotationForParameter;
2170
			}
2171
			return TagBits.AnnotationForField;
2172
		} else if (annotatedElement instanceof MethodDeclaration) {
2173
			return TagBits.AnnotationForMethod;
2174
		} else if (annotatedElement instanceof Argument) {
2175
			return TagBits.AnnotationForParameter;
2176
		} else if (annotatedElement instanceof ConstructorDeclaration) {
2177
			return TagBits.AnnotationForConstructor;
2178
		} else if (annotatedElement instanceof LocalDeclaration) {
2179
			return TagBits.AnnotationForLocalVariable;
2180
		} else if (annotatedElement instanceof ImportReference) {
2181
			return TagBits.AnnotationForPackage;
2182
		}
2183
		return 0;
2184
	}
2185
	
2113
	private TypeBinding[] computeTypes(Expression[] arguments) {
2186
	private TypeBinding[] computeTypes(Expression[] arguments) {
2114
		if (arguments == null) return null;
2187
		if (arguments == null) return null;
2115
		int argsLength = arguments.length;
2188
		int argsLength = arguments.length;
Lines 3784-3790 Link Here
3784
					this.options.camelCaseMatch,
3857
					this.options.camelCaseMatch,
3785
					IJavaSearchConstants.TYPE,
3858
					IJavaSearchConstants.TYPE,
3786
					this);
3859
					this);
3787
			acceptTypes();
3860
			acceptTypes(null);
3788
		}
3861
		}
3789
	}
3862
	}
3790
	
3863
	
Lines 4325-4331 Link Here
4325
			}
4398
			}
4326
			if (staticFieldsAndMethodOnly && this.insideQualifiedReference) relevance += R_NON_INHERITED; // This criterion doesn't concern types and is added to be balanced with field and method relevance.
4399
			if (staticFieldsAndMethodOnly && this.insideQualifiedReference) relevance += R_NON_INHERITED; // This criterion doesn't concern types and is added to be balanced with field and method relevance.
4327
4400
4328
			if (memberType.isClass()) {
4401
			if (memberType.isAnnotationType()) {
4402
				relevance += computeRelevanceForAnnotation();
4403
				relevance += computeRelevanceForAnnotationTarget(memberType);
4404
			} else if (memberType.isClass()) {
4329
				relevance += computeRelevanceForClass();
4405
				relevance += computeRelevanceForClass();
4330
				relevance += computeRelevanceForException(memberType.sourceName);
4406
				relevance += computeRelevanceForException(memberType.sourceName);
4331
			} else if(memberType.isEnum()) {
4407
			} else if(memberType.isEnum()) {
Lines 5441-5446 Link Here
5441
		}
5517
		}
5442
		return 0;
5518
		return 0;
5443
	}
5519
	}
5520
	private int computeRelevanceForAnnotationTarget(TypeBinding typeBinding){
5521
		if (this.assistNodeIsAnnotation &&
5522
				(this.targetedElement & TagBits.AnnotationTargetMASK) != 0) {
5523
			long target = typeBinding.getAnnotationTagBits() & TagBits.AnnotationTargetMASK;
5524
			if(target == 0 || (target & this.targetedElement) != 0) {
5525
				return R_TARGET;
5526
			}
5527
		}
5528
		return 0;
5529
	}
5444
	private int computeRelevanceForClass(){
5530
	private int computeRelevanceForClass(){
5445
		if(this.assistNodeIsClass) {
5531
		if(this.assistNodeIsClass) {
5446
			return R_CLASS;
5532
			return R_CLASS;
Lines 6259-6264 Link Here
6259
								relevance += computeRelevanceForClass();
6345
								relevance += computeRelevanceForClass();
6260
								relevance += computeRelevanceForQualification(false);
6346
								relevance += computeRelevanceForQualification(false);
6261
								relevance += computeRelevanceForRestrictions(IAccessRule.K_ACCESSIBLE); // no access restriction for nested type
6347
								relevance += computeRelevanceForRestrictions(IAccessRule.K_ACCESSIBLE); // no access restriction for nested type
6348
								relevance += computeRelevanceForAnnotationTarget(localType);
6262
								
6349
								
6263
								this.noProposal = false;
6350
								this.noProposal = false;
6264
								if(!this.requestor.isIgnored(CompletionProposal.TYPE_REF)) {
6351
								if(!this.requestor.isIgnored(CompletionProposal.TYPE_REF)) {
Lines 6412-6418 Link Here
6412
		
6499
		
6413
		if (!skip && proposeType && scope.enclosingSourceType() != null) {
6500
		if (!skip && proposeType && scope.enclosingSourceType() != null) {
6414
			findNestedTypes(token, scope.enclosingSourceType(), scope, proposeAllMemberTypes, typesFound);
6501
			findNestedTypes(token, scope.enclosingSourceType(), scope, proposeAllMemberTypes, typesFound);
6415
			if(!assistNodeIsConstructor) {
6502
			if(!assistNodeIsConstructor && !assistNodeIsAnnotation) {
6416
				// don't propose type parameters if the completion is a constructor ('new |')
6503
				// don't propose type parameters if the completion is a constructor ('new |')
6417
				findTypeParameters(token, scope);
6504
				findTypeParameters(token, scope);
6418
			}
6505
			}
Lines 6459-6464 Link Here
6459
				if (!CharOperation.prefixEquals(token, sourceType.sourceName, false)
6546
				if (!CharOperation.prefixEquals(token, sourceType.sourceName, false)
6460
						&& !(this.options.camelCaseMatch && CharOperation.camelCaseMatch(token, sourceType.sourceName))) continue;
6547
						&& !(this.options.camelCaseMatch && CharOperation.camelCaseMatch(token, sourceType.sourceName))) continue;
6461
	
6548
	
6549
				if (this.assistNodeIsAnnotation && !hasPossibleAnnotationTarget(sourceType, scope)) {
6550
					continue next;
6551
				}
6552
6462
				for (int j = typesFound.size; --j >= 0;) {
6553
				for (int j = typesFound.size; --j >= 0;) {
6463
					ReferenceBinding otherType = (ReferenceBinding) typesFound.elementAt(j);
6554
					ReferenceBinding otherType = (ReferenceBinding) typesFound.elementAt(j);
6464
	
6555
	
Lines 6489-6494 Link Here
6489
6580
6490
				if (sourceType.isAnnotationType()) {
6581
				if (sourceType.isAnnotationType()) {
6491
					relevance += computeRelevanceForAnnotation();
6582
					relevance += computeRelevanceForAnnotation();
6583
					relevance += computeRelevanceForAnnotationTarget(sourceType);
6492
				} else if (sourceType.isInterface()) {
6584
				} else if (sourceType.isInterface()) {
6493
					relevance += computeRelevanceForInterface();
6585
					relevance += computeRelevanceForInterface();
6494
				} else if(sourceType.isClass()){
6586
				} else if(sourceType.isClass()){
Lines 6648-6654 Link Here
6648
						this.options.camelCaseMatch,
6740
						this.options.camelCaseMatch,
6649
						searchFor,
6741
						searchFor,
6650
						this);
6742
						this);
6651
				acceptTypes();
6743
				acceptTypes(scope);
6652
			}
6744
			}
6653
			if(!isEmptyPrefix && !this.requestor.isIgnored(CompletionProposal.PACKAGE_REF)) {
6745
			if(!isEmptyPrefix && !this.requestor.isIgnored(CompletionProposal.PACKAGE_REF)) {
6654
				this.nameEnvironment.findPackages(token, this);
6746
				this.nameEnvironment.findPackages(token, this);
Lines 6767-6773 Link Here
6767
					this.options.camelCaseMatch,
6859
					this.options.camelCaseMatch,
6768
					searchFor,
6860
					searchFor,
6769
					this);
6861
					this);
6770
			acceptTypes();
6862
			acceptTypes(scope);
6771
		}
6863
		}
6772
		if(!this.requestor.isIgnored(CompletionProposal.PACKAGE_REF)) {
6864
		if(!this.requestor.isIgnored(CompletionProposal.PACKAGE_REF)) {
6773
			this.nameEnvironment.findPackages(qualifiedName, this);
6865
			this.nameEnvironment.findPackages(qualifiedName, this);
Lines 7576-7581 Link Here
7576
7668
7577
		return this.parser;
7669
		return this.parser;
7578
	}
7670
	}
7671
	
7672
	protected boolean hasPossibleAnnotationTarget(TypeBinding typeBinding, Scope scope) {
7673
		if (this.targetedElement == TagBits.AnnotationForPackage) {
7674
			long target = typeBinding.getAnnotationTagBits() & TagBits.AnnotationTargetMASK;
7675
			if(target != 0 && (target & TagBits.AnnotationForPackage) == 0) {
7676
				return false;
7677
			}
7678
		} else if ((this.targetedElement & TagBits.AnnotationForType) != 0) {
7679
			if (scope.parent != null &&
7680
					scope.parent.parent != null &&
7681
					scope.parent.referenceContext() instanceof CompletionOnAnnotationOfType &&
7682
					scope.parent.parent instanceof CompilationUnitScope) {
7683
				long target = typeBinding.getAnnotationTagBits() & TagBits.AnnotationTargetMASK;
7684
				if ((this.targetedElement & TagBits.AnnotationForAnnotationType) != 0) {
7685
					if(target != 0 && (target &(TagBits.AnnotationForType | TagBits.AnnotationForAnnotationType)) == 0) {
7686
						return false;
7687
					}
7688
				} else {
7689
					if(target != 0 && (target &(TagBits.AnnotationForType)) == 0) {
7690
						return false;
7691
					}
7692
				}
7693
			}
7694
		}
7695
		return true;
7696
	}
7579
7697
7580
	protected void reset() {
7698
	protected void reset() {
7581
7699

Return to bug 158985