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 168368 Details for
Bug 310747
[content assist] Irrelevant proposals while completing inside array initializer.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
proposed fix v1.0 + regression tests
patchIrrelevant.txt (text/plain), 7.08 KB, created by
Ayushman Jain
on 2010-05-13 07:19:13 EDT
(
hide
)
Description:
proposed fix v1.0 + regression tests
Filename:
MIME Type:
Creator:
Ayushman Jain
Created:
2010-05-13 07:19:13 EDT
Size:
7.08 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.411 >diff -u -r1.411 CompletionEngine.java >--- codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java 22 Apr 2010 16:11:44 -0000 1.411 >+++ codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java 13 May 2010 10:42:49 -0000 >@@ -3387,6 +3387,11 @@ > if(binding != null) { > if(!(variable.initialization instanceof ArrayInitializer)) { > addExpectedType(binding, scope); >+ } else { // https://bugs.eclipse.org/bugs/show_bug.cgi?id=310747 >+ // If the variable is of type X[], and we're in the initializer >+ // we should have X as the expected type for the variable initializers. >+ binding = binding.leafComponentType(); >+ addExpectedType(binding, scope); > } > } > } else if(parent instanceof Assignment) { >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.214 >diff -u -r1.214 CompletionParser.java >--- codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java 22 Apr 2010 12:56:48 -0000 1.214 >+++ codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java 13 May 2010 10:42:55 -0000 >@@ -875,8 +875,6 @@ > this.expressionLengthPtr--; > } > >- this.lastCheckPoint = this.scanner.currentPosition; >- > if(topKnownElementKind(COMPLETION_OR_ASSIST_PARSER, 1) == K_ARRAY_CREATION) { > ArrayAllocationExpression allocationExpression = new ArrayAllocationExpression(); > pushOnGenericsLengthStack(0); >#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.219 >diff -u -r1.219 CompletionTests.java >--- src/org/eclipse/jdt/core/tests/model/CompletionTests.java 22 Apr 2010 16:12:50 -0000 1.219 >+++ src/org/eclipse/jdt/core/tests/model/CompletionTests.java 13 May 2010 10:44:19 -0000 >@@ -21333,4 +21333,57 @@ > "toString[METHOD_REF]{toString(), Ljava.lang.Object;, ()Ljava.lang.String;, null, null, toString, null, replace[" + start1 + ", " + end1 + "], token[" + start1 + ", " + end1 +"], " + relevance1 + "}", > requestor.getResults()); > } >+ >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=310747 >+// To verify that we get correctly sorted proposals inside an array initializers >+// and we dont get comment strings as proposals >+public void testBug310747() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[1]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src/test/X.java", >+ "package test;" + >+ "class X {\n" + >+ " public X[] memberArray = {\n" + >+ " /**///completion here shouldnt give dubious proposals\n" + >+ " };\n" + >+ " public X memberGet() {\n" + >+ " return new X();\n" + >+ " }\n" + >+ " public X memberField;\n" + >+ "}\n"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, true, true, true, true, true); >+ requestor.allowAllRequiredProposals(); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "/**/"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ int relevance1 = R_RESOLVED + R_INTERESTING + R_CASE + R_NON_STATIC + R_EXACT_EXPECTED_TYPE; >+ int relevance2 = R_RESOLVED + R_INTERESTING + R_CASE + R_NON_STATIC; >+ int relevance3 = R_RESOLVED + R_CASE + R_NON_STATIC; >+ int start1 = str.lastIndexOf("/**/") + "".length(); >+ int end1 = start1 + "/**/".length(); >+ assertResults( >+ "expectedTypesSignatures={Ltest.X;}\n" + >+ "expectedTypesKeys={Ltest/X;}", >+ requestor.getContext()); >+ assertResults( >+ "X[TYPE_REF]{X, test, Ltest.X;, null, null, null, null, replace[" + end1 + ", " + end1 + "], token[" + end1 + ", " + end1 +"], " + relevance1 + "}\n" + >+ "memberField[FIELD_REF]{memberField, Ltest.X;, Ltest.X;, null, null, memberField, null, replace[" + end1 + ", " + end1 + "], token[" + end1 + ", " + end1 +"], " + relevance1 + "}\n" + >+ "memberGet[METHOD_REF]{memberGet(), Ltest.X;, ()Ltest.X;, null, null, memberGet, null, replace[" + end1 + ", " + end1 + "], token[" + end1 + ", " + end1 +"], " + relevance1 + "}\n" + >+ "clone[METHOD_REF]{clone(), Ljava.lang.Object;, ()Ljava.lang.Object;, null, null, clone, null, replace[" + end1 + ", " + end1 + "], token[" + end1 + ", " + end1 +"], " + relevance2 + "}\n" + >+ "equals[METHOD_REF]{equals(), Ljava.lang.Object;, (Ljava.lang.Object;)Z, null, null, equals, (obj), replace[" + end1 + ", " + end1 + "], token[" + end1 + ", " + end1 +"], " + relevance2 + "}\n" + >+ "getClass[METHOD_REF]{getClass(), Ljava.lang.Object;, ()Ljava.lang.Class;, null, null, getClass, null, replace[" + end1 + ", " + end1 + "], token[" + end1 + ", " + end1 +"], " + relevance2 + "}\n" + >+ "hashCode[METHOD_REF]{hashCode(), Ljava.lang.Object;, ()I, null, null, hashCode, null, replace[" + end1 + ", " + end1 + "], token[" + end1 + ", " + end1 +"], " + relevance2 + "}\n" + >+ "toString[METHOD_REF]{toString(), Ljava.lang.Object;, ()Ljava.lang.String;, null, null, toString, null, replace[" + end1 + ", " + end1 + "], token[" + end1 + ", " + end1 +"], " + relevance2 + "}\n" + >+ "finalize[METHOD_REF]{finalize(), Ljava.lang.Object;, ()V, null, null, finalize, null, replace[" + end1 + ", " + end1 + "], token[" + end1 + ", " + end1 +"], " + relevance3 + "}\n" + >+ "memberArray[FIELD_REF]{memberArray, Ltest.X;, [Ltest.X;, null, null, memberArray, null, replace[" + end1 + ", " + end1 + "], token[" + end1 + ", " + end1 +"], " + relevance3 + "}\n" + >+ "notify[METHOD_REF]{notify(), Ljava.lang.Object;, ()V, null, null, notify, null, replace[" + end1 + ", " + end1 + "], token[" + end1 + ", " + end1 +"], " + relevance3 + "}\n" + >+ "notifyAll[METHOD_REF]{notifyAll(), Ljava.lang.Object;, ()V, null, null, notifyAll, null, replace[" + end1 + ", " + end1 + "], token[" + end1 + ", " + end1 +"], " + relevance3 + "}\n" + >+ "wait[METHOD_REF]{wait(), Ljava.lang.Object;, (JI)V, null, null, wait, (millis, nanos), replace[" + end1 + ", " + end1 + "], token[" + end1 + ", " + end1 +"], " + relevance3 + "}\n" + >+ "wait[METHOD_REF]{wait(), Ljava.lang.Object;, (J)V, null, null, wait, (millis), replace[" + end1 + ", " + end1 + "], token[" + end1 + ", " + end1 +"], " + relevance3 + "}\n" + >+ "wait[METHOD_REF]{wait(), Ljava.lang.Object;, ()V, null, null, wait, null, replace[" + end1 + ", " + end1 + "], token[" + end1 + ", " + end1 +"], " + relevance3 + "}", >+ requestor.getReversedResults()); >+} > }
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 310747
:
168368
|
188253