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

Collapse All | Expand All

(-)codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java (+7 lines)
Lines 6010-6015 Link Here
6010
				}
6010
				}
6011
				ptr--;
6011
				ptr--;
6012
			}
6012
			}
6013
			
6014
			if (this.parser.assistNodeParent instanceof FieldDeclaration) {
6015
				FieldDeclaration fieldDeclaration = (FieldDeclaration) this.parser.assistNodeParent;
6016
				if (field.id > fieldDeclaration.binding.id)
6017
					// Don't propose fields declared after the current field declaration statement
6018
					continue next;
6019
			}
6013
6020
6014
			boolean prefixRequired = false;
6021
			boolean prefixRequired = false;
6015
6022
(-)src/org/eclipse/jdt/core/tests/model/CompletionTests.java (-1 / +31 lines)
Lines 37-43 Link Here
37
public class CompletionTests extends AbstractJavaModelCompletionTests {
37
public class CompletionTests extends AbstractJavaModelCompletionTests {
38
38
39
static {
39
static {
40
//	TESTS_NAMES = new String[] { "testDeprecationCheck17"};
40
	TESTS_NAMES = new String[] { "testBug310427c"};
41
}
41
}
42
public static Test suite() {
42
public static Test suite() {
43
	return buildModelTestSuite(CompletionTests.class);
43
	return buildModelTestSuite(CompletionTests.class);
Lines 21395-21400 Link Here
21395
			requestor.getResults());
21395
			requestor.getResults());
21396
}
21396
}
21397
21397
21398
21399
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=310427
21400
// To verify that we don't get proposals for fields that have not yet been declared
21401
// inside a field declaration statement
21402
public void testBug310427c() throws JavaModelException {
21403
	this.workingCopies = new ICompilationUnit[1];
21404
	this.workingCopies[0] = getWorkingCopy(
21405
		"/Completion/src/test/Test.java",
21406
		"package test;"+
21407
		"public class Test {\n" +
21408
		"       int myVar1 = 1;\n" +
21409
		"		int myVar2 = 1;\n" +
21410
		"		int myVar3 = myVar;\n" +
21411
		"       int myVar4 = 1;\n" +
21412
		"		int myVar5 = 1;\n" +
21413
		"	}\n" +
21414
		"}\n");
21415
21416
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
21417
	String str = this.workingCopies[0].getSource();
21418
	String completeBehind = "int myVar3 = myVar";
21419
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
21420
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
21421
21422
	assertResults(
21423
			"myVar1[FIELD_REF]{myVar1, Ltest.Test;, I, myVar1, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED + R_EXACT_EXPECTED_TYPE) + "}\n" +
21424
			"myVar2[FIELD_REF]{myVar2, Ltest.Test;, I, myVar2, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED + R_EXACT_EXPECTED_TYPE) + "}",
21425
			requestor.getResults());
21426
}
21427
21398
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=195346
21428
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=195346
21399
// To verify that array types aren't proposed inside case, and also
21429
// To verify that array types aren't proposed inside case, and also
21400
// that finals have a higher priority in suggestions inside case expressions.
21430
// that finals have a higher priority in suggestions inside case expressions.

Return to bug 310427