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 163912 Details for
Bug 249704
[code assist] autocomplete with anonymous classes does stop working
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
proposed fix v1.0 + regression tests
patchArrayInit.txt (text/plain), 4.02 KB, created by
Ayushman Jain
on 2010-04-06 11:07:07 EDT
(
hide
)
Description:
proposed fix v1.0 + regression tests
Filename:
MIME Type:
Creator:
Ayushman Jain
Created:
2010-04-06 11:07:07 EDT
Size:
4.02 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java,v >retrieving revision 1.211 >diff -u -r1.211 CompletionParser.java >--- codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java 30 Mar 2010 06:36:00 -0000 1.211 >+++ codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java 6 Apr 2010 15:05:36 -0000 >@@ -4321,7 +4321,14 @@ > this.qualifier = -1; > popUntilElement(K_SWITCH_LABEL); > if(topKnownElementKind(COMPLETION_OR_ASSIST_PARSER) != K_SWITCH_LABEL) { >- popUntilElement(K_BLOCK_DELIMITER); >+ if (topKnownElementKind(COMPLETION_OR_ASSIST_PARSER) == K_ARRAY_INITIALIZER) { >+ // if recovery is taking place in an array initializer, we should prevent popping >+ // upto the enclosing block until the array initializer is properly closed >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=249704 >+ popUntilElement(K_ARRAY_INITIALIZER); >+ } else { >+ popUntilElement(K_BLOCK_DELIMITER); >+ } > } > } > public void initializeScanner(){ >@@ -4606,7 +4613,13 @@ > case TokenNameRBRACE : > super.recoveryTokenCheck(); > if(this.currentElement != oldElement && oldElement instanceof RecoveredBlock) { >- popElement(K_BLOCK_DELIMITER); >+ if (topKnownElementKind(COMPLETION_OR_ASSIST_PARSER) == K_ARRAY_INITIALIZER) { >+ // When inside an array initializer, we shud not prematurely pop the enclosing block >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=249704 >+ popElement(K_ARRAY_INITIALIZER); >+ } else { >+ popElement(K_BLOCK_DELIMITER); >+ } > } > break; > case TokenNamecase : >#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.214 >diff -u -r1.214 CompletionTests.java >--- src/org/eclipse/jdt/core/tests/model/CompletionTests.java 31 Mar 2010 06:49:11 -0000 1.214 >+++ src/org/eclipse/jdt/core/tests/model/CompletionTests.java 6 Apr 2010 15:06:05 -0000 >@@ -21004,4 +21004,43 @@ > "Try[TYPE_REF]{Try, test, Ltest.Try;, null, null, 27}", > requestor.getResults()); > } >+ >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=249704 >+public void testBug249704() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[1]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src/test/Try.java", >+ "package test;\n" + >+ "import java.util.Arrays;\n" + >+ "public class Try {\n" + >+ " Object obj = new Object() {\n" + >+ " public void method() {\n" + >+ " Object obj = new Object() {\n" + >+ " int a = 1;\n" + >+ " public void anotherMethod() {\n" + >+ " try {}\n" + >+ " catch (Throwable e) {}\n" + >+ " Arrays.sort(new String[]{\"\"});\n" + >+ " }\n" + >+ " };\n" + >+ " e\n" + >+ " }\n" + >+ " };\n" + >+ "}\n"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ requestor.allowAllRequiredProposals(); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "e"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ assertResults( >+ // without the fix no proposals obtained. >+ "Error[TYPE_REF]{Error, java.lang, Ljava.lang.Error;, null, null, 17}\n" + >+ "Exception[TYPE_REF]{Exception, java.lang, Ljava.lang.Exception;, null, null, 17}\n" + >+ "equals[METHOD_REF]{Try.this.equals(), Ljava.lang.Object;, (Ljava.lang.Object;)Z, equals, (obj), 24}\n" + >+ "equals[METHOD_REF]{equals(), Ljava.lang.Object;, (Ljava.lang.Object;)Z, equals, (obj), 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
Flags:
Olivier_Thomann
:
iplog+
Actions:
View
|
Diff
Attachments on
bug 249704
: 163912