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 163490 Details for
Bug 292087
anonymous class in array member initializer confuses content assist
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Final patch with tests
patch.txt (text/plain), 4.06 KB, created by
Srikanth Sankaran
on 2010-03-31 02:45:02 EDT
(
hide
)
Description:
Final patch with tests
Filename:
MIME Type:
Creator:
Srikanth Sankaran
Created:
2010-03-31 02:45:02 EDT
Size:
4.06 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java,v >retrieving revision 1.417 >diff -u -r1.417 Parser.java >--- compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java 19 Mar 2010 12:43:52 -0000 1.417 >+++ compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java 31 Mar 2010 06:43:13 -0000 >@@ -10332,10 +10332,13 @@ > this.currentElement = this.currentElement.parent; > } else if(this.currentElement instanceof RecoveredField > && !(this.currentElement instanceof RecoveredInitializer)) { >- >- int end = ((RecoveredField)this.currentElement).fieldDeclaration.sourceEnd; >- this.currentElement.updateSourceEndIfNecessary(end); >- this.currentElement = this.currentElement.parent; >+ // Do not move focus to parent if we are still inside an array initializer >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=292087 >+ if (this.currentElement.bracketBalance <= 0) { >+ int end = ((RecoveredField)this.currentElement).fieldDeclaration.sourceEnd; >+ this.currentElement.updateSourceEndIfNecessary(end); >+ this.currentElement = this.currentElement.parent; >+ } > } > } > } >#P org.eclipse.jdt.core.tests.compiler >Index: src/org/eclipse/jdt/core/tests/compiler/parser/DietRecoveryTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/DietRecoveryTest.java,v >retrieving revision 1.61 >diff -u -r1.61 DietRecoveryTest.java >--- src/org/eclipse/jdt/core/tests/compiler/parser/DietRecoveryTest.java 29 Jun 2009 11:31:31 -0000 1.61 >+++ src/org/eclipse/jdt/core/tests/compiler/parser/DietRecoveryTest.java 31 Mar 2010 06:43:18 -0000 >@@ -4671,8 +4671,6 @@ > " }\n" + > " A foo(int i) {\n" + > " }\n" + >- " clone() {\n" + >- " }\n" + > " int bar() {\n" + > " }\n" + > "}\n"; >#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.213 >diff -u -r1.213 CompletionTests.java >--- src/org/eclipse/jdt/core/tests/model/CompletionTests.java 31 Mar 2010 04:58:01 -0000 1.213 >+++ src/org/eclipse/jdt/core/tests/model/CompletionTests.java 31 Mar 2010 06:43:29 -0000 >@@ -20974,4 +20974,34 @@ > "enclosingElement=<anonymous #1> {key=Ltest/TestBug307337$64;} [in obj [in TestBug307337 [in [Working copy] TestBug307337.java [in test [in src [in Completion]]]]]]", > requestor.getContext()); > } >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=292087 >+// To verify that anonymous class in array initializer doesnt cause >+// grief to content assist >+public void testBug292087() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[1]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src/test/Try.java", >+ "package test;\n" + >+ "public class Try extends Thread{\n" + >+ " public Runnable member[] = { new Runnable (){\n" + >+ " public void run() {}\n" + >+ " }\n" + >+ " };\n" + >+ " Tr\n" + >+ "}\n"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ requestor.allowAllRequiredProposals(); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "Tr"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ assertResults( >+ // without the fix no proposals obtained. >+ "Tr[POTENTIAL_METHOD_DECLARATION]{Tr, Ltest.Try;, ()V, Tr, null, 14}\n" + >+ "transient[KEYWORD]{transient, null, null, transient, null, 14}\n" + >+ "Try[TYPE_REF]{Try, test, Ltest.Try;, null, null, 27}", >+ 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 292087
:
163070
| 163490 |
167879
|
193572
|
193863
|
201378