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 176145 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 with small changes
patch310427.txt (text/plain), 4.02 KB, created by
Ayushman Jain
on 2010-08-09 07:03:53 EDT
(
hide
)
Description:
proposed fix for case 2 + test with small changes
Filename:
MIME Type:
Creator:
Ayushman Jain
Created:
2010-08-09 07:03:53 EDT
Size:
4.02 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 9 Aug 2010 10:17:56 -0000 >@@ -6001,14 +6001,13 @@ > if (this.assistNodeIsInsideCase && field.type instanceof ArrayBinding) > continue next; > >- int ptr = this.uninterestingBindingsPtr; >- // Cases where the binding is uninteresting eg. for completion occurring inside a field declaration, >- // the field binding is uninteresting and shouldn't be proposed. >- while (ptr >= 0) { >- if (this.uninterestingBindings[ptr] == field) { >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=310427 >+ // Don't propose field which is being declared currently >+ // Don't propose fields declared after the current field declaration statement >+ if (this.parser.assistNodeParent instanceof FieldDeclaration) { >+ FieldDeclaration fieldDeclaration = (FieldDeclaration) this.parser.assistNodeParent; >+ if (field.id >= fieldDeclaration.binding.id) > continue next; >- } >- ptr--; > } > > 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 9 Aug 2010 10:19:01 -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); >@@ -21346,26 +21346,31 @@ > } > > // https://bugs.eclipse.org/bugs/show_bug.cgi?id=310427 >-// To verify that we don't get proposals for the field in whose declaration >-// content assist is being invoked >+// To verify that we don't get proposals for fields that have not yet been declared >+// inside a field declaration statement > public void testBug310427a() throws JavaModelException { > this.workingCopies = new ICompilationUnit[1]; > this.workingCopies[0] = getWorkingCopy( > "/Completion/src/test/Test.java", > "package test;"+ > "public class Test {\n" + >- " private int myField1;\n" + >- " private int myField2 = myFiel;\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 = "private int myField2 = myFiel"; >+ String completeBehind = "int myVar3 = myVar"; > int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); > > assertResults( >- "myField1[FIELD_REF]{myField1, Ltest.Test;, I, myField1, null, 57}", >+ "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()); > } >
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