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 165415 Details for
Bug 244820
Content assist after 'instanceof' should also work in assignment
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
proposed fix v1.0 + updated regression tests
patchErrorComplete.txt (text/plain), 4.42 KB, created by
Ayushman Jain
on 2010-04-20 08:12:04 EDT
(
hide
)
Description:
proposed fix v1.0 + updated regression tests
Filename:
MIME Type:
Creator:
Ayushman Jain
Created:
2010-04-20 08:12:04 EDT
Size:
4.42 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.212 >diff -u -r1.212 CompletionParser.java >--- codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java 7 Apr 2010 12:42:47 -0000 1.212 >+++ codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java 20 Apr 2010 11:54:54 -0000 >@@ -560,7 +560,8 @@ > if(expression == this.assistNode > || (expression instanceof Assignment // https://bugs.eclipse.org/bugs/show_bug.cgi?id=287939 > && ((Assignment)expression).expression == this.assistNode >- && (this.expressionPtr > 0 && this.expressionStack[this.expressionPtr - 1] instanceof InstanceOfExpression)) >+ && (this.expressionPtr > 0 && this.expressionStack[this.expressionPtr - 1] instanceof InstanceOfExpression >+ || this.elementPtr >= 0 && this.elementObjectInfoStack[this.elementPtr] instanceof InstanceOfExpression)) > || (expression instanceof AllocationExpression > && ((AllocationExpression)expression).type == this.assistNode)){ > buildMoreCompletionContext(expression); >#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.215 >diff -u -r1.215 CompletionTests.java >--- src/org/eclipse/jdt/core/tests/model/CompletionTests.java 7 Apr 2010 12:42:43 -0000 1.215 >+++ src/org/eclipse/jdt/core/tests/model/CompletionTests.java 20 Apr 2010 11:55:38 -0000 >@@ -21043,4 +21043,58 @@ > "equals[METHOD_REF]{equals(), Ljava.lang.Object;, (Ljava.lang.Object;)Z, equals, (obj), 27}", > requestor.getResults()); > } >+ >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=244820 >+// To verify that autocast works correctly even when the compilation unit >+// has some compilation errors. >+public void testBug244820() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[1]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src/test/CompletionAfterInstanceOf.java", >+ "package test;" + >+ "class MyString {\n" + >+ " public String toWelcome() {\n" + >+ " return \"welcome\";\n" + >+ " }\n" + >+ "}\n" + >+ "public class CompletionAfterInstanceOf {\n" + >+ " void foo() {\n" + >+ " Object chars= null;\n" + >+ " Object ch = null;\n" + >+ " String lower = null;\n" + >+ " if (ch instanceof MyString) {\n" + >+ " ch.t; \n" + >+ " }\n" + >+ " if (ch instanceof MyString) {\n" + >+ " return ch.t; \n" + >+ " }\n" + >+ " if (chars instanceof MyString) {\n" + >+ " lower = chars.to; \n" + >+ " }\n" + >+ " if (ch instanceof MyString) {\n" + >+ " String low = ch.t; \n" + >+ " }\n" + >+ " }\n" + >+ "}\n"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, true, true, true, true, true); >+ requestor.allowAllRequiredProposals(); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "lower = chars.to"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ int relevance1 = R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_EXACT_EXPECTED_TYPE; >+ int start1 = str.lastIndexOf("to") + "".length(); >+ int end1 = start1 + "to".length(); >+ int start2 = str.lastIndexOf("chars.to"); >+ int end2 = start2 + "chars.to".length(); >+ int start3 = str.lastIndexOf("chars."); >+ int end3 = start3 + "chars".length(); >+ >+ assertResults( >+ "toString[METHOD_REF]{toString(), Ljava.lang.Object;, ()Ljava.lang.String;, null, null, toString, null, replace[" + start1 + ", " + end1 + "], token[" + start1 + ", " + end1 +"], " + relevance1 + "}\n" + >+ "toWelcome[METHOD_REF_WITH_CASTED_RECEIVER]{((MyString)chars).toWelcome(), Ltest.MyString;, ()Ljava.lang.String;, Ltest.MyString;, null, null, toWelcome, null, replace[" + start2 +", " + end2 + "], token[" + start1 + ", " + end1 + "], receiver[" + start3 + ", " + end3 + "], " + relevance1 + "}", >+ 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:
srikanth_sankaran
:
iplog+
srikanth_sankaran
:
review+
Actions:
View
|
Diff
Attachments on
bug 244820
: 165415