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

(-)src/org/eclipse/jdt/core/tests/model/CompletionWithMissingTypesTests.java (-19 / +19 lines)
Lines 66-72 Link Here
66
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
66
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
67
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
67
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
68
68
69
	int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED;
69
	int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS;
70
	int start1 = str.lastIndexOf("m.b") + "m.".length();
70
	int start1 = str.lastIndexOf("m.b") + "m.".length();
71
	int end1 = start1 + "b".length();
71
	int end1 = start1 + "b".length();
72
	int start2 = str.lastIndexOf("MissingType");
72
	int start2 = str.lastIndexOf("MissingType");
Lines 103-109 Link Here
103
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
103
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
104
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
104
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
105
	
105
	
106
	int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED;
106
	int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS;
107
	int start1 = str.lastIndexOf("m.b") + "m.".length();
107
	int start1 = str.lastIndexOf("m.b") + "m.".length();
108
	int end1 = start1 + "b".length();
108
	int end1 = start1 + "b".length();
109
	int start2 = str.lastIndexOf("MissingType");
109
	int start2 = str.lastIndexOf("MissingType");
Lines 146-152 Link Here
146
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
146
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
147
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
147
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
148
148
149
	int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED;
149
	int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS;
150
	int start1 = str.lastIndexOf("m.b") + "m.".length();
150
	int start1 = str.lastIndexOf("m.b") + "m.".length();
151
	int end1 = start1 + "b".length();
151
	int end1 = start1 + "b".length();
152
	int start2 = str.lastIndexOf("MissingType");
152
	int start2 = str.lastIndexOf("MissingType");
Lines 183-190 Link Here
183
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
183
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
184
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
184
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
185
185
186
	int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED;
186
	int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED + R_NO_PROBLEMS;
187
	int relevance2 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED;
187
	int relevance2 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS;
188
	int start1 = str.lastIndexOf("m.") + "m.".length();
188
	int start1 = str.lastIndexOf("m.") + "m.".length();
189
	int end1 = start1;
189
	int end1 = start1;
190
	int start2 = str.lastIndexOf("MissingType");
190
	int start2 = str.lastIndexOf("MissingType");
Lines 243-249 Link Here
243
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
243
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
244
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
244
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
245
	
245
	
246
	int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED;
246
	int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS;
247
	int start1 = str.lastIndexOf("m.b") + "m.".length();
247
	int start1 = str.lastIndexOf("m.b") + "m.".length();
248
	int end1 = start1 + "b".length();
248
	int end1 = start1 + "b".length();
249
	int start2 = str.lastIndexOf("MissingType");
249
	int start2 = str.lastIndexOf("MissingType");
Lines 282-288 Link Here
282
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
282
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
283
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
283
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
284
	
284
	
285
	int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED;
285
	int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS;
286
	int start1 = str.lastIndexOf("m.b") + "m.".length();
286
	int start1 = str.lastIndexOf("m.b") + "m.".length();
287
	int end1 = start1 + "b".length();
287
	int end1 = start1 + "b".length();
288
	int start2 = str.lastIndexOf("MissingType");
288
	int start2 = str.lastIndexOf("MissingType");
Lines 409-415 Link Here
409
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
409
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
410
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
410
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
411
411
412
	int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED;
412
	int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS;
413
	int start1 = str.lastIndexOf("m.b") + "m.".length();
413
	int start1 = str.lastIndexOf("m.b") + "m.".length();
414
	int end1 = start1 + "b".length();
414
	int end1 = start1 + "b".length();
415
	int start2 = str.lastIndexOf("MissingType");
415
	int start2 = str.lastIndexOf("MissingType");
Lines 450-456 Link Here
450
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
450
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
451
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
451
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
452
452
453
	int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED;
453
	int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS;
454
	int start1 = str.lastIndexOf("m.b") + "m.".length();
454
	int start1 = str.lastIndexOf("m.b") + "m.".length();
455
	int end1 = start1 + "b".length();
455
	int end1 = start1 + "b".length();
456
	int start2 = str.lastIndexOf("MissingMemberType");
456
	int start2 = str.lastIndexOf("MissingMemberType");
Lines 487-493 Link Here
487
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
487
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
488
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
488
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
489
	
489
	
490
	int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED;
490
	int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS;
491
	int start1 = str.lastIndexOf("m().b") + "m().".length();
491
	int start1 = str.lastIndexOf("m().b") + "m().".length();
492
	int end1 = start1 + "b".length();
492
	int end1 = start1 + "b".length();
493
	int start2 = str.lastIndexOf("MissingType");
493
	int start2 = str.lastIndexOf("MissingType");
Lines 524-530 Link Here
524
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
524
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
525
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
525
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
526
526
527
	int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED;
527
	int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS;
528
	int start1 = str.lastIndexOf("m(0).b") + "m(0).".length();
528
	int start1 = str.lastIndexOf("m(0).b") + "m(0).".length();
529
	int end1 = start1 + "b".length();
529
	int end1 = start1 + "b".length();
530
	int start2 = str.lastIndexOf("MissingType");
530
	int start2 = str.lastIndexOf("MissingType");
Lines 653-659 Link Here
653
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
653
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
654
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
654
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
655
655
656
	int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED;
656
	int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS;
657
	int start1 = str.lastIndexOf("m().b") + "m().".length();
657
	int start1 = str.lastIndexOf("m().b") + "m().".length();
658
	int end1 = start1 + "b".length();
658
	int end1 = start1 + "b".length();
659
	int start2 = str.lastIndexOf("MissingType");
659
	int start2 = str.lastIndexOf("MissingType");
Lines 692-698 Link Here
692
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
692
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
693
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
693
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
694
694
695
	int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED;
695
	int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS;
696
	int start1 = str.lastIndexOf("m.b") + "m.".length();
696
	int start1 = str.lastIndexOf("m.b") + "m.".length();
697
	int end1 = start1 + "b".length();
697
	int end1 = start1 + "b".length();
698
	int start2 = str.lastIndexOf("MissingType");
698
	int start2 = str.lastIndexOf("MissingType");
Lines 797-803 Link Here
797
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
797
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
798
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
798
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
799
799
800
	int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED;
800
	int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS;
801
	int start1 = str.lastIndexOf("m.e") + "m.".length();
801
	int start1 = str.lastIndexOf("m.e") + "m.".length();
802
	int end1 = start1 + "e".length();
802
	int end1 = start1 + "e".length();
803
	int start2 = str.lastIndexOf("MissingType");
803
	int start2 = str.lastIndexOf("MissingType");
Lines 844-850 Link Here
844
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
844
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
845
		this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
845
		this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
846
	
846
	
847
		int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED;
847
		int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS;
848
		int start1 = str.lastIndexOf("m.b") + "m.".length();
848
		int start1 = str.lastIndexOf("m.b") + "m.".length();
849
		int end1 = start1 + "b".length();
849
		int end1 = start1 + "b".length();
850
		int start2 = str.lastIndexOf("MissingMemberType");
850
		int start2 = str.lastIndexOf("MissingMemberType");
Lines 940-946 Link Here
940
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
940
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
941
		this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
941
		this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
942
	
942
	
943
		int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED;
943
		int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS;
944
		int start1 = str.lastIndexOf("m.b") + "m.".length();
944
		int start1 = str.lastIndexOf("m.b") + "m.".length();
945
		int end1 = start1 + "b".length();
945
		int end1 = start1 + "b".length();
946
		int start2 = str.lastIndexOf("MissingMemberMemberType");
946
		int start2 = str.lastIndexOf("MissingMemberMemberType");
Lines 954-960 Link Here
954
	}
954
	}
955
}
955
}
956
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=44984
956
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=44984
957
public void _test0023() throws JavaModelException {
957
public void test0023() throws JavaModelException {
958
	this.oldOptions = JavaCore.getOptions();
958
	this.oldOptions = JavaCore.getOptions();
959
	
959
	
960
	try {
960
	try {
Lines 1035-1041 Link Here
1035
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1035
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1036
		this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
1036
		this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
1037
	
1037
	
1038
		int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED;
1038
		int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS;
1039
		int start1 = str.lastIndexOf("m.b") + "m.".length();
1039
		int start1 = str.lastIndexOf("m.b") + "m.".length();
1040
		int end1 = start1 + "b".length();
1040
		int end1 = start1 + "b".length();
1041
		int start2 = str.lastIndexOf("MissingMemberType");
1041
		int start2 = str.lastIndexOf("MissingMemberType");
Lines 1129-1135 Link Here
1129
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1129
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
1130
		this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
1130
		this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
1131
	
1131
	
1132
		int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED;
1132
		int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS;
1133
		int start1 = str.lastIndexOf("m.b") + "m.".length();
1133
		int start1 = str.lastIndexOf("m.b") + "m.".length();
1134
		int end1 = start1 + "b".length();
1134
		int end1 = start1 + "b".length();
1135
		int start2 = str.lastIndexOf("MissingMemberMemberType");
1135
		int start2 = str.lastIndexOf("MissingMemberMemberType");
(-)src/org/eclipse/jdt/core/tests/model/CompletionWithMissingTypesTests_1_5.java (-9 / +56 lines)
Lines 64-70 Link Here
64
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
64
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
65
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
65
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
66
66
67
	int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED;
67
	int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS;
68
	int start1 = str.lastIndexOf("m.b") + "m.".length();
68
	int start1 = str.lastIndexOf("m.b") + "m.".length();
69
	int end1 = start1 + "b".length();
69
	int end1 = start1 + "b".length();
70
	int start2 = str.lastIndexOf("MissingType");
70
	int start2 = str.lastIndexOf("MissingType");
Lines 108-114 Link Here
108
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
108
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
109
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
109
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
110
110
111
	int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED;
111
	int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS;
112
	int start1 = str.lastIndexOf("m.b") + "m.".length();
112
	int start1 = str.lastIndexOf("m.b") + "m.".length();
113
	int end1 = start1 + "b".length();
113
	int end1 = start1 + "b".length();
114
	int start2 = str.lastIndexOf("MissingType2");
114
	int start2 = str.lastIndexOf("MissingType2");
Lines 159-165 Link Here
159
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
159
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
160
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
160
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
161
161
162
	int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED;
162
	int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS;
163
	int start1 = str.lastIndexOf("m.b") + "m.".length();
163
	int start1 = str.lastIndexOf("m.b") + "m.".length();
164
	int end1 = start1 + "b".length();
164
	int end1 = start1 + "b".length();
165
	int start2 = str.lastIndexOf("MissingType2");
165
	int start2 = str.lastIndexOf("MissingType2");
Lines 206-212 Link Here
206
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
206
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
207
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
207
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
208
208
209
	int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED;
209
	int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS;
210
	int start1 = str.lastIndexOf("m.b") + "m.".length();
210
	int start1 = str.lastIndexOf("m.b") + "m.".length();
211
	int end1 = start1 + "b".length();
211
	int end1 = start1 + "b".length();
212
	int start2 = str.lastIndexOf("MissingType<");
212
	int start2 = str.lastIndexOf("MissingType<");
Lines 269-275 Link Here
269
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
269
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
270
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
270
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
271
271
272
	int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED;
272
	int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS;
273
	int start1 = str.lastIndexOf("m.b") + "m.".length();
273
	int start1 = str.lastIndexOf("m.b") + "m.".length();
274
	int end1 = start1 + "b".length();
274
	int end1 = start1 + "b".length();
275
	int start2 = str.lastIndexOf("MissingType1");
275
	int start2 = str.lastIndexOf("MissingType1");
Lines 324-330 Link Here
324
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
324
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
325
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
325
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
326
326
327
	int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED;
327
	int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS;
328
	int start1 = str.lastIndexOf("m(0, 0).b") + "m(0, 0).".length();
328
	int start1 = str.lastIndexOf("m(0, 0).b") + "m(0, 0).".length();
329
	int end1 = start1 + "b".length();
329
	int end1 = start1 + "b".length();
330
	int start2 = str.lastIndexOf("MissingType");
330
	int start2 = str.lastIndexOf("MissingType");
Lines 367-373 Link Here
367
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
367
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
368
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
368
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
369
369
370
	int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED;
370
	int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS;
371
	int start1 = str.lastIndexOf("m.b") + "m.".length();
371
	int start1 = str.lastIndexOf("m.b") + "m.".length();
372
	int end1 = start1 + "b".length();
372
	int end1 = start1 + "b".length();
373
	int start2 = str.lastIndexOf("MissingType");
373
	int start2 = str.lastIndexOf("MissingType");
Lines 406-412 Link Here
406
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
406
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
407
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
407
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
408
408
409
	int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED;
409
	int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS;
410
	int start1 = str.lastIndexOf("m.b") + "m.".length();
410
	int start1 = str.lastIndexOf("m.b") + "m.".length();
411
	int end1 = start1 + "b".length();
411
	int end1 = start1 + "b".length();
412
	int start2 = str.lastIndexOf("MissingType");
412
	int start2 = str.lastIndexOf("MissingType");
Lines 476-482 Link Here
476
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
476
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
477
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
477
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
478
478
479
	int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED;
479
	int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS;
480
	int start1 = str.lastIndexOf("m.b") + "m.".length();
480
	int start1 = str.lastIndexOf("m.b") + "m.".length();
481
	int end1 = start1 + "b".length();
481
	int end1 = start1 + "b".length();
482
	int start2 = str.lastIndexOf("MissingType");
482
	int start2 = str.lastIndexOf("MissingType");
Lines 519-522 Link Here
519
			"",
519
			"",
520
			requestor.getResults());
520
			requestor.getResults());
521
}
521
}
522
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=161204
523
public void test0012() throws JavaModelException {
524
	this.workingCopies = new ICompilationUnit[3];
525
	this.workingCopies[0] = getWorkingCopy(
526
		"/Completion/src/test/Test.java",
527
		"package test;"+
528
		"public class Test {\n" + 
529
		"  void foo() {\n" + 
530
 		"    MissingType m = null;\n" + 
531
 		"    m.b\n" + 
532
		"  }\n" + 
533
		"}\n");
534
	
535
	this.workingCopies[1] = getWorkingCopy(
536
		"/Completion/src/missing1/MissingType.java",
537
		"package missing1;"+
538
		"public class MissingType<T> {\n" + 
539
		"  public void bar() {};\n" + 
540
		"}\n");
541
	
542
	this.workingCopies[2] = getWorkingCopy(
543
		"/Completion/src/missing2/MissingType.java",
544
		"package missing2;"+
545
		"public class MissingType {\n" + 
546
		"  public void bar() {};\n" + 
547
		"}\n");
548
549
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true);
550
	requestor.allowAllRequiredProposals();
551
	String str = this.workingCopies[0].getSource();
552
	String completeBehind = "m.b";
553
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
554
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
555
556
	int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED;
557
	int relevance2 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS;
558
	int start1 = str.lastIndexOf("m.b") + "m.".length();
559
	int end1 = start1 + "b".length();
560
	int start2 = str.lastIndexOf("MissingType");
561
	int end2 = start2 + "MissingType".length();
562
	assertResults(
563
			"bar[METHOD_REF]{bar(), Lmissing1.MissingType;, ()V, bar, null, ["+start1+", "+end1+"], " + (relevance1) + "}\n" +
564
			"   MissingType<T>[TYPE_REF]{missing1.MissingType, missing1, Lmissing1.MissingType<TT;>;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}\n" +
565
			"bar[METHOD_REF]{bar(), Lmissing2.MissingType;, ()V, bar, null, ["+start1+", "+end1+"], " + (relevance2) + "}\n" +
566
			"   MissingType[TYPE_REF]{missing2.MissingType, missing2, Lmissing2.MissingType;, null, null, ["+start2+", "+end2+"], " + (relevance2) + "}",
567
			requestor.getResults());
568
}
522
}
569
}
(-)src/org/eclipse/jdt/core/tests/model/CompletionWithMissingTypesTests2.java (-2 / +2 lines)
Lines 143-149 Link Here
143
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
143
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
144
		cu.codeComplete(cursorLocation, requestor);
144
		cu.codeComplete(cursorLocation, requestor);
145
		
145
		
146
		int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED;
146
		int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS;
147
		int start1 = str.lastIndexOf("x.fo") + "x.".length();
147
		int start1 = str.lastIndexOf("x.fo") + "x.".length();
148
		int end1 = start1 + "fo".length();
148
		int end1 = start1 + "fo".length();
149
		int start2 = str.lastIndexOf("XX");
149
		int start2 = str.lastIndexOf("XX");
Lines 237-243 Link Here
237
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
237
		int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
238
		cu.codeComplete(cursorLocation, requestor);
238
		cu.codeComplete(cursorLocation, requestor);
239
		
239
		
240
		int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED;
240
		int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS;
241
		int start1 = str.lastIndexOf("x.fo") + "x.".length();
241
		int start1 = str.lastIndexOf("x.fo") + "x.".length();
242
		int end1 = start1 + "fo".length();
242
		int end1 = start1 + "fo".length();
243
		int start2 = str.lastIndexOf("XX");
243
		int start2 = str.lastIndexOf("XX");
(-)codeassist/org/eclipse/jdt/internal/codeassist/RelevanceConstants.java (+1 lines)
Lines 40-43 Link Here
40
	int R_INLINE_TAG = 31;
40
	int R_INLINE_TAG = 31;
41
	int R_VALUE_TAG = 31;
41
	int R_VALUE_TAG = 31;
42
	int R_NON_INHERITED = 2;
42
	int R_NON_INHERITED = 2;
43
	int R_NO_PROBLEMS = 1;
43
}
44
}
(-)codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java (-55 / +126 lines)
Lines 46-51 Link Here
46
import org.eclipse.jdt.internal.compiler.problem.AbortCompilation;
46
import org.eclipse.jdt.internal.compiler.problem.AbortCompilation;
47
import org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory;
47
import org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory;
48
import org.eclipse.jdt.internal.compiler.problem.ProblemReporter;
48
import org.eclipse.jdt.internal.compiler.problem.ProblemReporter;
49
import org.eclipse.jdt.internal.compiler.problem.ProblemSeverities;
49
import org.eclipse.jdt.internal.compiler.util.SuffixConstants;
50
import org.eclipse.jdt.internal.compiler.util.SuffixConstants;
50
import org.eclipse.jdt.internal.compiler.util.HashtableOfObject;
51
import org.eclipse.jdt.internal.compiler.util.HashtableOfObject;
51
import org.eclipse.jdt.internal.compiler.util.ObjectVector;
52
import org.eclipse.jdt.internal.compiler.util.ObjectVector;
Lines 71-79 Link Here
71
	public class CompletionProblemFactory extends DefaultProblemFactory {
72
	public class CompletionProblemFactory extends DefaultProblemFactory {
72
		private int lastErrorStart;
73
		private int lastErrorStart;
73
		
74
		
74
		public boolean checkProblems = false;
75
		private boolean checkProblems = false;
75
		public boolean hasProblems = false;
76
		public boolean hasForbiddenProblems = false;
76
77
		public boolean hasAllowedProblems = false;
78
		
77
		public CompletionProblemFactory(Locale loc) {
79
		public CompletionProblemFactory(Locale loc) {
78
			super(loc);
80
			super(loc);
79
		}
81
		}
Lines 109-134 Link Here
109
				CompletionEngine.this.problem = pb;
111
				CompletionEngine.this.problem = pb;
110
				this.lastErrorStart = start;
112
				this.lastErrorStart = start;
111
			}
113
			}
112
			if (this.checkProblems && !this.hasProblems) {
114
			if (this.checkProblems && !this.hasForbiddenProblems) {
113
				if (id == IProblem.UsingDeprecatedType) {
115
				switch (id) {
114
					this.hasProblems =
116
					case IProblem.UsingDeprecatedType:
115
						CompletionEngine.this.options.checkDeprecation;
117
						this.hasForbiddenProblems =
116
				} else if (id == IProblem.NotVisibleType) {
118
							CompletionEngine.this.options.checkDeprecation;
117
					this.hasProblems =
119
						break;
118
						CompletionEngine.this.options.checkVisibility;
120
					case IProblem.NotVisibleType:
119
				} else if (id == IProblem.ForbiddenReference) {
121
						this.hasForbiddenProblems =
120
					this.hasProblems =
122
							CompletionEngine.this.options.checkVisibility;
121
						CompletionEngine.this.options.checkForbiddenReference;
123
						break;
122
				} else if (id == IProblem.DiscouragedReference) {
124
					case IProblem.ForbiddenReference:
123
					this.hasProblems =
125
						this.hasForbiddenProblems =
124
						CompletionEngine.this.options.checkDiscouragedReference;
126
							CompletionEngine.this.options.checkForbiddenReference;
125
				} else {
127
						break;
126
					this.hasProblems = true;
128
					case IProblem.DiscouragedReference:
129
						this.hasForbiddenProblems =
130
							CompletionEngine.this.options.checkDiscouragedReference;
131
						break;
132
					default:
133
						if ((severity & ProblemSeverities.Optional) != 0) {
134
							this.hasAllowedProblems = true;
135
						} else {
136
							this.hasForbiddenProblems = true;
137
						}
138
						
139
						break;
127
				}
140
				}
128
			}
141
			}
129
			
142
			
130
			return pb;
143
			return pb;
131
		}
144
		}
145
		
146
		public void startCheckingProblems() {
147
			this.checkProblems = true;
148
			this.hasForbiddenProblems = false;
149
			this.hasAllowedProblems = false;
150
		}
151
		
152
		public void stopCheckingProblems() {
153
			this.checkProblems = false;
154
		}
132
	}
155
	}
133
156
134
	private class AcceptedType {
157
	private class AcceptedType {
Lines 805-811 Link Here
805
				SourceTypeBinding enclosingType = scope.enclosingSourceType();
828
				SourceTypeBinding enclosingType = scope.enclosingSourceType();
806
				if (!enclosingType.isAnnotationType()) {
829
				if (!enclosingType.isAnnotationType()) {
807
					if (!this.requestor.isIgnored(CompletionProposal.METHOD_DECLARATION)) {
830
					if (!this.requestor.isIgnored(CompletionProposal.METHOD_DECLARATION)) {
808
						findMethods(this.completionToken,null,null,enclosingType,scope,new ObjectVector(),false,false,true,null,null,false,false,true,null, null, null);
831
						findMethods(this.completionToken,null,null,enclosingType,scope,new ObjectVector(),false,false,true,null,null,false,false,true,null, null, null, false);
809
					}
832
					}
810
					if (!this.requestor.isIgnored(CompletionProposal.POTENTIAL_METHOD_DECLARATION)) {
833
					if (!this.requestor.isIgnored(CompletionProposal.POTENTIAL_METHOD_DECLARATION)) {
811
						proposeNewMethod(this.completionToken, enclosingType);
834
						proposeNewMethod(this.completionToken, enclosingType);
Lines 827-833 Link Here
827
				SourceTypeBinding enclosingType = scope.enclosingSourceType();
850
				SourceTypeBinding enclosingType = scope.enclosingSourceType();
828
				if (!enclosingType.isAnnotationType()) {
851
				if (!enclosingType.isAnnotationType()) {
829
					if (!this.requestor.isIgnored(CompletionProposal.METHOD_DECLARATION)) {
852
					if (!this.requestor.isIgnored(CompletionProposal.METHOD_DECLARATION)) {
830
						findMethods(this.completionToken,null,null,scope.enclosingSourceType(),scope,new ObjectVector(),false,false,true,null,null,false,false,true,null, null, null);
853
						findMethods(this.completionToken,null,null,scope.enclosingSourceType(),scope,new ObjectVector(),false,false,true,null,null,false,false,true,null, null, null, false);
831
					}
854
					}
832
					if (!this.requestor.isIgnored(CompletionProposal.POTENTIAL_METHOD_DECLARATION)) {
855
					if (!this.requestor.isIgnored(CompletionProposal.POTENTIAL_METHOD_DECLARATION)) {
833
						proposeNewMethod(this.completionToken, scope.enclosingSourceType());
856
						proposeNewMethod(this.completionToken, scope.enclosingSourceType());
Lines 940-946 Link Here
940
				setSourceRange((int) (completionPosition >>> 32), (int) completionPosition);
963
				setSourceRange((int) (completionPosition >>> 32), (int) completionPosition);
941
				TypeBinding receiverType = ((VariableBinding) qualifiedBinding).type;
964
				TypeBinding receiverType = ((VariableBinding) qualifiedBinding).type;
942
				if (receiverType != null) {
965
				if (receiverType != null) {
943
					findFieldsAndMethods(this.completionToken, receiverType.capture(scope, ref.sourceEnd), scope, ref, scope,false,false, null, null, null);
966
					findFieldsAndMethods(this.completionToken, receiverType.capture(scope, ref.sourceEnd), scope, ref, scope,false,false, null, null, null, false);
944
				} else if (this.assistNodeInJavadoc == 0 &&
967
				} else if (this.assistNodeInJavadoc == 0 &&
945
						(this.requestor.isAllowingRequiredProposals(CompletionProposal.FIELD_REF, CompletionProposal.TYPE_REF) ||
968
						(this.requestor.isAllowingRequiredProposals(CompletionProposal.FIELD_REF, CompletionProposal.TYPE_REF) ||
946
								this.requestor.isAllowingRequiredProposals(CompletionProposal.METHOD_REF, CompletionProposal.TYPE_REF))) {
969
								this.requestor.isAllowingRequiredProposals(CompletionProposal.METHOD_REF, CompletionProposal.TYPE_REF))) {
Lines 1029-1035 Link Here
1029
						false,
1052
						false,
1030
						null,
1053
						null,
1031
						null,
1054
						null,
1032
						null);
1055
						null,
1056
						false);
1033
				}
1057
				}
1034
1058
1035
				if (!isInsideAnnotationAttribute && !this.requestor.isIgnored(CompletionProposal.METHOD_REF)) {
1059
				if (!isInsideAnnotationAttribute && !this.requestor.isIgnored(CompletionProposal.METHOD_REF)) {
Lines 1050-1056 Link Here
1050
						false,
1074
						false,
1051
						null,
1075
						null,
1052
						null,
1076
						null,
1053
						null);
1077
						null,
1078
						false);
1054
				}
1079
				}
1055
1080
1056
			} else if (qualifiedBinding instanceof PackageBinding) {
1081
			} else if (qualifiedBinding instanceof PackageBinding) {
Lines 1134-1140 Link Here
1134
					access.receiver instanceof SuperReference,
1159
					access.receiver instanceof SuperReference,
1135
					null,
1160
					null,
1136
					null,
1161
					null,
1137
					null);
1162
					null,
1163
					false);
1138
			}
1164
			}
1139
1165
1140
		} else if (astNode instanceof CompletionOnMessageSend) {
1166
		} else if (astNode instanceof CompletionOnMessageSend) {
Lines 1165-1171 Link Here
1165
					false,
1191
					false,
1166
					null,
1192
					null,
1167
					null,
1193
					null,
1168
					null);
1194
					null,
1195
					false);
1169
			}
1196
			}
1170
		} else if (astNode instanceof CompletionOnExplicitConstructorCall) {
1197
		} else if (astNode instanceof CompletionOnExplicitConstructorCall) {
1171
			if (!this.requestor.isIgnored(CompletionProposal.METHOD_REF)) {
1198
			if (!this.requestor.isIgnored(CompletionProposal.METHOD_REF)) {
Lines 1403-1409 Link Here
1403
								false,
1430
								false,
1404
								null,
1431
								null,
1405
								null,
1432
								null,
1406
								null);
1433
								null,
1434
								false);
1407
					}
1435
					}
1408
				}
1436
				}
1409
			}
1437
			}
Lines 1479-1485 Link Here
1479
							true,
1507
							true,
1480
							null,
1508
							null,
1481
							null,
1509
							null,
1482
							null);
1510
							null,
1511
							false);
1483
					}
1512
					}
1484
1513
1485
					if (!this.requestor.isIgnored(CompletionProposal.METHOD_REF)
1514
					if (!this.requestor.isIgnored(CompletionProposal.METHOD_REF)
Lines 1500-1506 Link Here
1500
							true,
1529
							true,
1501
							null,
1530
							null,
1502
							null,
1531
							null,
1503
							null);
1532
							null,
1533
							false);
1504
						if (fieldRef.receiverType instanceof ReferenceBinding) {
1534
						if (fieldRef.receiverType instanceof ReferenceBinding) {
1505
							ReferenceBinding refBinding = (ReferenceBinding)fieldRef.receiverType;
1535
							ReferenceBinding refBinding = (ReferenceBinding)fieldRef.receiverType;
1506
							if (this.completionToken == null
1536
							if (this.completionToken == null
Lines 1551-1557 Link Here
1551
						true,
1581
						true,
1552
						null,
1582
						null,
1553
						null,
1583
						null,
1554
						null);
1584
						null,
1585
						false);
1555
				}
1586
				}
1556
			} else if (astNode instanceof CompletionOnJavadocAllocationExpression) {
1587
			} else if (astNode instanceof CompletionOnJavadocAllocationExpression) {
1557
//				setSourceRange(astNode.sourceStart, astNode.sourceEnd, false);
1588
//				setSourceRange(astNode.sourceStart, astNode.sourceEnd, false);
Lines 2547-2553 Link Here
2547
		boolean canBePrefixed,
2578
		boolean canBePrefixed,
2548
		Binding[] missingElements,
2579
		Binding[] missingElements,
2549
		int[] missingElementsStarts,
2580
		int[] missingElementsStarts,
2550
		int[] missingElementsEnds) {
2581
		int[] missingElementsEnds,
2582
		boolean missingElementsHaveProblems) {
2551
2583
2552
		ObjectVector newFieldsFound = new ObjectVector();
2584
		ObjectVector newFieldsFound = new ObjectVector();
2553
		// Inherited fields which are hidden by subclasses are filtered out
2585
		// Inherited fields which are hidden by subclasses are filtered out
Lines 2658-2663 Link Here
2658
			if (onlyStaticFields && this.insideQualifiedReference) {
2690
			if (onlyStaticFields && this.insideQualifiedReference) {
2659
				relevance += computeRelevanceForInheritance(receiverType, field.declaringClass);
2691
				relevance += computeRelevanceForInheritance(receiverType, field.declaringClass);
2660
			}
2692
			}
2693
			if (missingElements != null) {
2694
				relevance += computeRelevanceForMissingElements(missingElementsHaveProblems);
2695
			}
2661
			
2696
			
2662
			this.noProposal = false;
2697
			this.noProposal = false;
2663
			// Standard proposal
2698
			// Standard proposal
Lines 2751-2757 Link Here
2751
		boolean canBePrefixed,
2786
		boolean canBePrefixed,
2752
		Binding[] missingElements,
2787
		Binding[] missingElements,
2753
		int[] missingElementsStarts,
2788
		int[] missingElementsStarts,
2754
		int[] missingElementsEnds) {
2789
		int[] missingElementsEnds,
2790
		boolean missingElementsHaveProblems) {
2755
2791
2756
		boolean notInJavadoc = this.assistNodeInJavadoc == 0;
2792
		boolean notInJavadoc = this.assistNodeInJavadoc == 0;
2757
		if (fieldName == null && notInJavadoc)
2793
		if (fieldName == null && notInJavadoc)
Lines 2795-2801 Link Here
2795
					canBePrefixed,
2831
					canBePrefixed,
2796
					missingElements,
2832
					missingElements,
2797
					missingElementsStarts,
2833
					missingElementsStarts,
2798
					missingElementsEnds);
2834
					missingElementsEnds,
2835
					missingElementsHaveProblems);
2799
			}
2836
			}
2800
			currentType = currentType.superclass();
2837
			currentType = currentType.superclass();
2801
		} while (notInJavadoc && currentType != null);
2838
		} while (notInJavadoc && currentType != null);
Lines 2819-2825 Link Here
2819
						canBePrefixed,
2856
						canBePrefixed,
2820
						missingElements,
2857
						missingElements,
2821
						missingElementsStarts,
2858
						missingElementsStarts,
2822
						missingElementsEnds);
2859
						missingElementsEnds,
2860
						missingElementsHaveProblems);
2823
				}
2861
				}
2824
2862
2825
				ReferenceBinding[] itsInterfaces = anInterface.superInterfaces();
2863
				ReferenceBinding[] itsInterfaces = anInterface.superInterfaces();
Lines 2848-2854 Link Here
2848
		boolean superCall,
2886
		boolean superCall,
2849
		Binding[] missingElements,
2887
		Binding[] missingElements,
2850
		int[] missingElementsStarts,
2888
		int[] missingElementsStarts,
2851
		int[] missingElementsEnds) {
2889
		int[] missingElementsEnds,
2890
		boolean missingElementsHaveProblems) {
2852
2891
2853
		if (token == null)
2892
		if (token == null)
2854
			return;
2893
			return;
Lines 2872-2878 Link Here
2872
				relevance += computeRelevanceForCaseMatching(token,lengthField);
2911
				relevance += computeRelevanceForCaseMatching(token,lengthField);
2873
				relevance += computeRelevanceForExpectingType(TypeBinding.INT);
2912
				relevance += computeRelevanceForExpectingType(TypeBinding.INT);
2874
				relevance += computeRelevanceForRestrictions(IAccessRule.K_ACCESSIBLE); // no access restriction for length field
2913
				relevance += computeRelevanceForRestrictions(IAccessRule.K_ACCESSIBLE); // no access restriction for length field
2875
				
2914
				if (missingElements != null) {
2915
					relevance += computeRelevanceForMissingElements(missingElementsHaveProblems);
2916
				}
2876
				this.noProposal = false;
2917
				this.noProposal = false;
2877
				if(!isIgnored(CompletionProposal.FIELD_REF, missingElements != null)) {
2918
				if(!isIgnored(CompletionProposal.FIELD_REF, missingElements != null)) {
2878
					CompletionProposal proposal = this.createProposal(CompletionProposal.FIELD_REF, this.actualCompletionPosition);
2919
					CompletionProposal proposal = this.createProposal(CompletionProposal.FIELD_REF, this.actualCompletionPosition);
Lines 2918-2924 Link Here
2918
				relevance += computeRelevanceForStatic(false, false);
2959
				relevance += computeRelevanceForStatic(false, false);
2919
				relevance += computeRelevanceForQualification(false);
2960
				relevance += computeRelevanceForQualification(false);
2920
				relevance += computeRelevanceForRestrictions(IAccessRule.K_ACCESSIBLE); // no access restriction for clone() method
2961
				relevance += computeRelevanceForRestrictions(IAccessRule.K_ACCESSIBLE); // no access restriction for clone() method
2921
				
2962
				if (missingElements != null) {
2963
					relevance += computeRelevanceForMissingElements(missingElementsHaveProblems);
2964
				}
2922
				char[] completion;
2965
				char[] completion;
2923
				if (this.source != null
2966
				if (this.source != null
2924
					&& this.source.length > this.endPosition
2967
					&& this.source.length > this.endPosition
Lines 2986-2992 Link Here
2986
				false,
3029
				false,
2987
				missingElements,
3030
				missingElements,
2988
				missingElementsStarts,
3031
				missingElementsStarts,
2989
				missingElementsEnds);
3032
				missingElementsEnds,
3033
				missingElementsHaveProblems);
2990
		}
3034
		}
2991
3035
2992
		if(proposeMethod) {
3036
		if(proposeMethod) {
Lines 3007-3013 Link Here
3007
				false,
3051
				false,
3008
				missingElements,
3052
				missingElements,
3009
				missingElementsStarts,
3053
				missingElementsStarts,
3010
				missingElementsEnds);
3054
				missingElementsEnds,
3055
				missingElementsHaveProblems);
3011
		}
3056
		}
3012
	}
3057
	}
3013
	
3058
	
Lines 3158-3164 Link Here
3158
						TypeBinding guessedType,
3203
						TypeBinding guessedType,
3159
						Binding[] missingElements,
3204
						Binding[] missingElements,
3160
						int[] missingElementsStarts,
3205
						int[] missingElementsStarts,
3161
						int[] missingElementsEnds) {
3206
						int[] missingElementsEnds,
3207
						boolean hasProblems) {
3162
					findFieldsAndMethods(
3208
					findFieldsAndMethods(
3163
						CompletionEngine.this.completionToken,
3209
						CompletionEngine.this.completionToken,
3164
						guessedType,
3210
						guessedType,
Lines 3169-3175 Link Here
3169
						false,
3215
						false,
3170
						missingElements,
3216
						missingElements,
3171
						missingElementsStarts,
3217
						missingElementsStarts,
3172
						missingElementsEnds);
3218
						missingElementsEnds,
3219
						hasProblems);
3173
					
3220
					
3174
				}
3221
				}
3175
			};
3222
			};
Lines 4002-4008 Link Here
4002
		boolean canBePrefixed,
4049
		boolean canBePrefixed,
4003
		Binding[] missingElements,
4050
		Binding[] missingElements,
4004
		int[] missingElementssStarts,
4051
		int[] missingElementssStarts,
4005
		int[] missingElementsEnds) {
4052
		int[] missingElementsEnds,
4053
		boolean missingElementsHaveProblems) {
4006
4054
4007
		if (selector == null)
4055
		if (selector == null)
4008
			return;
4056
			return;
Lines 4041-4047 Link Here
4041
							canBePrefixed,
4089
							canBePrefixed,
4042
							missingElements,
4090
							missingElements,
4043
							missingElementssStarts,
4091
							missingElementssStarts,
4044
							missingElementsEnds);
4092
							missingElementsEnds,
4093
							missingElementsHaveProblems);
4045
					}
4094
					}
4046
				}
4095
				}
4047
4096
Lines 4104-4110 Link Here
4104
						true,
4153
						true,
4105
						null,
4154
						null,
4106
						null,
4155
						null,
4107
						null);
4156
						null,
4157
						false);
4108
					staticsOnly |= enclosingType.isStatic();
4158
					staticsOnly |= enclosingType.isStatic();
4109
					break;
4159
					break;
4110
4160
Lines 4133-4139 Link Here
4133
		boolean canBePrefixed,
4183
		boolean canBePrefixed,
4134
		Binding[] missingElements,
4184
		Binding[] missingElements,
4135
		int[] missingElementsStarts,
4185
		int[] missingElementsStarts,
4136
		int[] missingElementsEnds) {
4186
		int[] missingElementsEnds,
4187
		boolean missingElementsHaveProblems) {
4137
4188
4138
		ObjectVector newMethodsFound =  new ObjectVector();
4189
		ObjectVector newMethodsFound =  new ObjectVector();
4139
		// Inherited methods which are hidden by subclasses are filtered out
4190
		// Inherited methods which are hidden by subclasses are filtered out
Lines 4339-4344 Link Here
4339
			if (onlyStaticMethods && this.insideQualifiedReference) {
4390
			if (onlyStaticMethods && this.insideQualifiedReference) {
4340
				relevance += computeRelevanceForInheritance(receiverType, method.declaringClass);
4391
				relevance += computeRelevanceForInheritance(receiverType, method.declaringClass);
4341
			}
4392
			}
4393
			if (missingElements != null) {
4394
				relevance += computeRelevanceForMissingElements(missingElementsHaveProblems);
4395
			}
4342
			
4396
			
4343
			this.noProposal = false;
4397
			this.noProposal = false;
4344
			// Standard proposal
4398
			// Standard proposal
Lines 4587-4592 Link Here
4587
		}
4641
		}
4588
		return 0;
4642
		return 0;
4589
	}
4643
	}
4644
	private int computeRelevanceForMissingElements(boolean hasProblems) {
4645
		if (!hasProblems) {
4646
			return R_NO_PROBLEMS;
4647
		}
4648
		return 0;
4649
	}
4590
	private int computeRelevanceForQualification(boolean prefixRequired) {
4650
	private int computeRelevanceForQualification(boolean prefixRequired) {
4591
		if(!prefixRequired && !this.insideQualifiedReference) {
4651
		if(!prefixRequired && !this.insideQualifiedReference) {
4592
			return R_UNQUALIFIED;
4652
			return R_UNQUALIFIED;
Lines 5043-5049 Link Here
5043
		boolean canBePrefixed,
5103
		boolean canBePrefixed,
5044
		Binding[] missingElements,
5104
		Binding[] missingElements,
5045
		int[] missingElementsStarts,
5105
		int[] missingElementsStarts,
5046
		int[] missingElementsEnds) {
5106
		int[] missingElementsEnds,
5107
		boolean missingElementsHaveProblems) {
5047
5108
5048
		boolean notInJavadoc = this.assistNodeInJavadoc == 0;
5109
		boolean notInJavadoc = this.assistNodeInJavadoc == 0;
5049
		if (selector == null && notInJavadoc) {
5110
		if (selector == null && notInJavadoc) {
Lines 5083-5089 Link Here
5083
						canBePrefixed,
5144
						canBePrefixed,
5084
						missingElements,
5145
						missingElements,
5085
						missingElementsStarts,
5146
						missingElementsStarts,
5086
						missingElementsEnds);
5147
						missingElementsEnds,
5148
						missingElementsHaveProblems);
5087
				} else {
5149
				} else {
5088
					findInterfacesMethods(
5150
					findInterfacesMethods(
5089
						selector,
5151
						selector,
Lines 5103-5109 Link Here
5103
						canBePrefixed,
5165
						canBePrefixed,
5104
						missingElements,
5166
						missingElements,
5105
						missingElementsStarts,
5167
						missingElementsStarts,
5106
						missingElementsEnds);
5168
						missingElementsEnds,
5169
						missingElementsHaveProblems);
5107
				}
5170
				}
5108
				
5171
				
5109
				currentType = scope.getJavaLangObject();
5172
				currentType = scope.getJavaLangObject();
Lines 5127-5133 Link Here
5127
						canBePrefixed,
5190
						canBePrefixed,
5128
						missingElements,
5191
						missingElements,
5129
						missingElementsStarts,
5192
						missingElementsStarts,
5130
						missingElementsEnds);
5193
						missingElementsEnds,
5194
						missingElementsHaveProblems);
5131
					
5195
					
5132
					currentType = receiverType.superclass();
5196
					currentType = receiverType.superclass();
5133
				}
5197
				}
Lines 5164-5170 Link Here
5164
						canBePrefixed,
5228
						canBePrefixed,
5165
						missingElements,
5229
						missingElements,
5166
						missingElementsStarts,
5230
						missingElementsStarts,
5167
						missingElementsEnds);
5231
						missingElementsEnds,
5232
						missingElementsHaveProblems);
5168
				}
5233
				}
5169
			}
5234
			}
5170
			
5235
			
Lines 5187-5193 Link Here
5187
					canBePrefixed,
5252
					canBePrefixed,
5188
					missingElements,
5253
					missingElements,
5189
					missingElementsStarts,
5254
					missingElementsStarts,
5190
					missingElementsEnds);
5255
					missingElementsEnds,
5256
					missingElementsHaveProblems);
5191
			} else {
5257
			} else {
5192
				hasPotentialDefaultAbstractMethods = false;
5258
				hasPotentialDefaultAbstractMethods = false;
5193
			}
5259
			}
Lines 6044-6050 Link Here
6044
									true,
6110
									true,
6045
									null,
6111
									null,
6046
									null,
6112
									null,
6047
									null);
6113
									null,
6114
									false);
6048
							}
6115
							}
6049
							if(proposeMethod && !insideAnnotationAttribute) {
6116
							if(proposeMethod && !insideAnnotationAttribute) {
6050
								findMethods(
6117
								findMethods(
Lines 6064-6070 Link Here
6064
									true,
6131
									true,
6065
									null,
6132
									null,
6066
									null,
6133
									null,
6067
									null);
6134
									null,
6135
									false);
6068
							}
6136
							}
6069
						}
6137
						}
6070
						staticsOnly |= enclosingType.isStatic();
6138
						staticsOnly |= enclosingType.isStatic();
Lines 6100-6106 Link Here
6100
										false,
6168
										false,
6101
										null,
6169
										null,
6102
										null,
6170
										null,
6103
										null);
6171
										null,
6172
										false);
6104
								}
6173
								}
6105
								if(proposeMethod && !insideAnnotationAttribute) {
6174
								if(proposeMethod && !insideAnnotationAttribute) {
6106
									findMethods(
6175
									findMethods(
Lines 6120-6126 Link Here
6120
										false,
6189
										false,
6121
										null,
6190
										null,
6122
										null,
6191
										null,
6123
										null);
6192
										null,
6193
										false);
6124
								}
6194
								}
6125
							}
6195
							}
6126
						} else {
6196
						} else {
Lines 6140-6146 Link Here
6140
												false,
6210
												false,
6141
												null,
6211
												null,
6142
												null,
6212
												null,
6143
												null);
6213
												null,
6214
												false);
6144
								}
6215
								}
6145
							} else if ((binding.kind() & Binding.METHOD) != 0) {
6216
							} else if ((binding.kind() & Binding.METHOD) != 0) {
6146
								if(proposeMethod && !insideAnnotationAttribute) {
6217
								if(proposeMethod && !insideAnnotationAttribute) {
(-)codeassist/org/eclipse/jdt/internal/codeassist/MissingTypesGuesser.java (-8 / +8 lines)
Lines 35-41 Link Here
35
				TypeBinding guessedType,
35
				TypeBinding guessedType,
36
				Binding[] missingElements,
36
				Binding[] missingElements,
37
				int[] missingElementsStarts,
37
				int[] missingElementsStarts,
38
				int[] missingElementsEnds);
38
				int[] missingElementsEnds,
39
				boolean hasProblems);
39
		
40
		
40
	}
41
	}
41
	
42
	
Lines 521-544 Link Here
521
			
522
			
522
			nextSubstitution(substituedTypeNodes, subtitutions, substitutionsIndexes);
523
			nextSubstitution(substituedTypeNodes, subtitutions, substitutionsIndexes);
523
			
524
			
524
			this.problemFactory.hasProblems = false;
525
			
525
			this.problemFactory.checkProblems = true;
526
			this.problemFactory.startCheckingProblems();
526
			TypeBinding guessedType = null;
527
			TypeBinding guessedType = null;
527
			switch (scope.kind) {
528
			switch (scope.kind) {
528
				case Scope.METHOD_SCOPE :
529
				case Scope.METHOD_SCOPE :
529
				case Scope.BLOCK_SCOPE :
530
				case Scope.BLOCK_SCOPE :
530
					resolutionCleaner.cleanUp(convertedType, (BlockScope)scope);
531
					resolutionCleaner.cleanUp(convertedType, (BlockScope)scope);
531
					convertedType.traverse(resolutionCleaner, (BlockScope)scope);
532
					guessedType = convertedType.resolveType((BlockScope)scope);
532
					guessedType = convertedType.resolveType((BlockScope)scope);
533
					break;
533
					break;
534
				case Scope.CLASS_SCOPE :
534
				case Scope.CLASS_SCOPE :
535
					resolutionCleaner.cleanUp(convertedType, (ClassScope)scope);
535
					resolutionCleaner.cleanUp(convertedType, (ClassScope)scope);
536
					convertedType.traverse(resolutionCleaner, (ClassScope)scope);
537
					guessedType = convertedType.resolveType((ClassScope)scope);
536
					guessedType = convertedType.resolveType((ClassScope)scope);
538
					break;
537
					break;
539
			}
538
			}
540
			this.problemFactory.checkProblems = false;
539
			this.problemFactory.stopCheckingProblems();
541
			if (!this.problemFactory.hasProblems) {
540
			if (!this.problemFactory.hasForbiddenProblems) {
542
				if (guessedType != null) {
541
				if (guessedType != null) {
543
					Binding[] missingElements = new Binding[length];
542
					Binding[] missingElements = new Binding[length];
544
					int[] missingElementsStarts = new int[length];
543
					int[] missingElementsStarts = new int[length];
Lines 554-560 Link Here
554
								guessedType.capture(scope, typeRef.sourceEnd),
553
								guessedType.capture(scope, typeRef.sourceEnd),
555
								missingElements,
554
								missingElements,
556
								missingElementsStarts,
555
								missingElementsStarts,
557
								missingElementsEnds);
556
								missingElementsEnds,
557
								this.problemFactory.hasAllowedProblems);
558
					}
558
					}
559
				}
559
				}
560
			}
560
			}

Return to bug 161204