Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 175971 Details for
Bug 310427
[content assist] FUP of 236306: Variable proposed before definition.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
proposed fix for case 2 + test
patchFieldComplete.txt (text/plain), 3.44 KB, created by
Ayushman Jain
on 2010-08-05 14:54:16 EDT
(
hide
)
Description:
proposed fix for case 2 + test
Filename:
MIME Type:
Creator:
Ayushman Jain
Created:
2010-08-05 14:54:16 EDT
Size:
3.44 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java,v >retrieving revision 1.416 >diff -u -r1.416 CompletionEngine.java >--- codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java 22 Jul 2010 04:25:46 -0000 1.416 >+++ codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java 5 Aug 2010 18:52:18 -0000 >@@ -6010,6 +6010,13 @@ > } > ptr--; > } >+ >+ if (this.parser.assistNodeParent instanceof FieldDeclaration) { >+ FieldDeclaration fieldDeclaration = (FieldDeclaration) this.parser.assistNodeParent; >+ if (field.id > fieldDeclaration.binding.id) >+ // Don't propose fields declared after the current field declaration statement >+ continue next; >+ } > > boolean prefixRequired = false; > >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/model/CompletionTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests.java,v >retrieving revision 1.222 >diff -u -r1.222 CompletionTests.java >--- src/org/eclipse/jdt/core/tests/model/CompletionTests.java 7 Jul 2010 13:19:15 -0000 1.222 >+++ src/org/eclipse/jdt/core/tests/model/CompletionTests.java 5 Aug 2010 18:52:55 -0000 >@@ -37,7 +37,7 @@ > public class CompletionTests extends AbstractJavaModelCompletionTests { > > static { >-// TESTS_NAMES = new String[] { "testDeprecationCheck17"}; >+ TESTS_NAMES = new String[] { "testBug310427c"}; > } > public static Test suite() { > return buildModelTestSuite(CompletionTests.class); >@@ -21395,6 +21395,36 @@ > requestor.getResults()); > } > >+ >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=310427 >+// To verify that we don't get proposals for fields that have not yet been declared >+// inside a field declaration statement >+public void testBug310427c() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[1]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src/test/Test.java", >+ "package test;"+ >+ "public class Test {\n" + >+ " int myVar1 = 1;\n" + >+ " int myVar2 = 1;\n" + >+ " int myVar3 = myVar;\n" + >+ " int myVar4 = 1;\n" + >+ " int myVar5 = 1;\n" + >+ " }\n" + >+ "}\n"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "int myVar3 = myVar"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ assertResults( >+ "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" + >+ "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) + "}", >+ requestor.getResults()); >+} >+ > // https://bugs.eclipse.org/bugs/show_bug.cgi?id=195346 > // To verify that array types aren't proposed inside case, and also > // that finals have a higher priority in suggestions inside case expressions.
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 310427
:
168132
|
168427
|
175971
|
176145