View | Details | Raw Unified | Return to bug 169682 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/model/CompletionTests.java (+144 lines)
Lines 163-168 Link Here
163
		}
163
		}
164
	}
164
	}
165
}
165
}
166
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=169682
167
public void testBug169682a() throws JavaModelException {
168
	this.workingCopies = new ICompilationUnit[1];
169
	
170
	String source =
171
		"package test;\n"+
172
		"\n"+
173
		"public class Test \n"+
174
		"{\n"+
175
		"        public Test() \n"+
176
		"        {\n"+
177
		"                this.t// do ctrl+space here\n"+
178
		"        }\n"+
179
		"\n"+
180
		"        Object field = new Object() \n"+
181
		"        {\n"+
182
		"                public void foo() {\n"+
183
		"\n"+
184
		"                        if(true)\n"+
185
		"                        {}\n"+
186
		"                        else if(true)\n"+
187
		"                        {}\n"+
188
		"                        else if(true)\n"+
189
		"                        {}\n"+
190
		"                        else if(true)\n"+
191
		"                        {}\n"+
192
		"                        else if(true)\n"+
193
		"                        {}\n"+
194
		"                        else if(true)\n"+
195
		"                        {}\n"+
196
		"                        else if(true)\n"+
197
		"                        {}\n"+
198
		"                        else if(true)\n"+
199
		"                        {}\n"+
200
		"                        else if(true)\n"+
201
		"                        {}\n"+
202
		"                        else if(true)\n"+
203
		"                        {}\n"+
204
		"                        else if(true)\n"+
205
		"                        {}\n"+
206
		"                        else if(true)\n"+
207
		"                        {}\n"+
208
		"                        else if(true)\n"+
209
		"                        {}\n"+
210
		"                        else if(true)\n"+
211
		"                        {}\n"+
212
		"                        else if(true)\n"+
213
		"                        {}\n"+
214
		"                        else if(true)\n"+
215
		"                        {}\n"+
216
		"                        else if(true)\n"+
217
		"                        {}\n"+
218
		"                        else if(true)\n"+
219
		"                        {}\n"+
220
		"                        else if(true)\n"+
221
		"                        {}\n"+
222
		"                        else if(true)\n"+
223
		"                        {}\n"+
224
		"                        else if(true)\n"+
225
		"                        {}\n"+
226
		"                        else if(true)\n"+
227
		"                        {}\n"+
228
		"                        else if(true)\n"+
229
		"                        {}\n"+
230
		"                        else if(true)\n"+
231
		"                        {}\n"+
232
		"                        else if(true)\n"+
233
		"                        {}\n"+
234
		"                        else if(true)\n"+
235
		"                        {}\n"+
236
		"                        else if(true)\n"+
237
		"                        {}\n"+
238
		"                        else if(true)\n"+
239
		"                        {}\n"+
240
		"                        else if(true)\n"+
241
		"                        {}\n"+
242
		"                        else if(true)\n"+
243
		"                        {}\n"+
244
		"                        else if(true)\n"+
245
		"                        {}\n"+
246
		"                        else if(true)\n"+
247
		"                        {}\n"+
248
		"                        else if(true)\n"+
249
		"                        {}\n"+
250
		"                        else if(true)\n"+
251
		"                        {}\n"+
252
		"                        else if(true)\n"+
253
		"                        {}\n"+
254
		"                        else if(true)\n"+
255
		"                        {}\n"+
256
		"                        else if(true)\n"+
257
		"                        {\n"+
258
		"                                if(true)\n"+
259
		"                                {\n"+
260
		"                                        if(true)\n"+
261
		"                                        {\n"+
262
		"                                                boolean result[][];\n"+
263
		"                                        }\n"+
264
		"                                }\n"+
265
		"                        }       \n"+
266
		"                }\n"+
267
		"        };   \n"+   
268
		"}";
269
	
270
	this.workingCopies[0] = getWorkingCopy(
271
		"/Completion/src/test/Test.java",
272
		source);
273
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
274
	String str = this.workingCopies[0].getSource();
275
	String completeBehind = "this.t";
276
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
277
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
278
279
	assertResults(
280
			"toString[METHOD_REF]{toString(), Ljava.lang.Object;, ()Ljava.lang.String;, toString, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED) + "}",
281
			requestor.getResults());
282
}
283
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=169682
284
public void testBug169682b() throws JavaModelException {
285
	this.workingCopies = new ICompilationUnit[1];
286
	
287
	String source =
288
		"package test;\n"+
289
		"public class Test\n"+
290
		"{\n"+
291
		"        #\n"+
292
		"        int[] i;\n"+
293
		"        Obj x; // do ctrl+space at |\n"+
294
		"}";
295
	
296
	this.workingCopies[0] = getWorkingCopy(
297
		"/Completion/src/test/Test.java",
298
		source);
299
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
300
	String str = this.workingCopies[0].getSource();
301
	String completeBehind = "Obj";
302
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
303
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
304
305
	assertResults(
306
			"Obj[POTENTIAL_METHOD_DECLARATION]{Obj, Ltest.Test;, ()V, Obj, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_NON_RESTRICTED) + "}\n" +
307
			"Object[TYPE_REF]{Object, java.lang, Ljava.lang.Object;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
308
			requestor.getResults());
309
}
166
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=102572
310
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=102572
167
public void testCamelCaseField1() throws JavaModelException {
311
public void testCamelCaseField1() throws JavaModelException {
168
	this.oldOptions = JavaCore.getOptions();
312
	this.oldOptions = JavaCore.getOptions();
(-)codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java (-2 / +1 lines)
Lines 2221-2231 Link Here
2221
2221
2222
	boolean isLocalDeclaration = this.nestedMethod[this.nestedType] != 0;
2222
	boolean isLocalDeclaration = this.nestedMethod[this.nestedType] != 0;
2223
	int variableIndex = this.variablesCounter[this.nestedType];
2223
	int variableIndex = this.variablesCounter[this.nestedType];
2224
	int extendedDimension = this.intStack[this.intPtr + 1];
2225
2224
2226
	this.hasUnusedModifiers = false;
2225
	this.hasUnusedModifiers = false;
2227
2226
2228
	if(isLocalDeclaration || indexOfAssistIdentifier() < 0 || variableIndex != 0 || extendedDimension != 0) {
2227
	if(isLocalDeclaration || indexOfAssistIdentifier() < 0 || variableIndex != 0) {
2229
		this.identifierPtr++;
2228
		this.identifierPtr++;
2230
		this.identifierLengthPtr++;
2229
		this.identifierLengthPtr++;
2231
2230

Return to bug 169682