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 134427 Details for
Bug 274557
CompletionContext problem with annotation value element
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch
bug274557_003.txt (text/plain), 6.71 KB, created by
David Audel
on 2009-05-05 10:10:03 EDT
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
David Audel
Created:
2009-05-05 10:10:03 EDT
Size:
6.71 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/model/CompletionContextTests_1_5.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionContextTests_1_5.java,v >retrieving revision 1.12 >diff -u -r1.12 CompletionContextTests_1_5.java >--- src/org/eclipse/jdt/core/tests/model/CompletionContextTests_1_5.java 9 Sep 2008 12:43:37 -0000 1.12 >+++ src/org/eclipse/jdt/core/tests/model/CompletionContextTests_1_5.java 5 May 2009 14:08:17 -0000 >@@ -1300,4 +1300,74 @@ > "}", > result.context); > } >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=274557 >+public void test0041() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[2]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src3/test/X.java", >+ "package test;\n" + >+ "public class X {\n" + >+ " @TestAnnot(value=\"\")\n" + >+ " public int field = 0;\n" + >+ "}"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src3/test/TestAnnot.java", >+ "package test;\n" + >+ "public @interface X {\n" + >+ " String value();\n" + >+ "}"); >+ >+ String str = this.workingCopies[0].getSource(); >+ int tokenStart = str.lastIndexOf("\"\""); >+ int tokenEnd = tokenStart + "\"\"".length() - 1; >+ int cursorLocation = str.lastIndexOf("value=\"") + "value=\"".length(); >+ >+ CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); >+ >+ assertResults( >+ "completion offset="+(cursorLocation)+"\n" + >+ "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + >+ "completion token=\"\"\n" + >+ "completion token kind=TOKEN_KIND_STRING_LITERAL\n" + >+ "expectedTypesSignatures=null\n" + >+ "expectedTypesKeys=null\n" + >+ "completion token location=UNKNOWN", >+ result.context); >+} >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=274557 >+public void test0042() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[2]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src3/test/X.java", >+ "package test;\n" + >+ "public class X {\n" + >+ " @TestAnnot(\"\")\n" + >+ " public int field = 0;\n" + >+ "}"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src3/test/TestAnnot.java", >+ "package test;\n" + >+ "public @interface X {\n" + >+ " String value();\n" + >+ "}"); >+ >+ String str = this.workingCopies[0].getSource(); >+ int tokenStart = str.lastIndexOf("\"\""); >+ int tokenEnd = tokenStart + "\"\"".length() - 1; >+ int cursorLocation = str.lastIndexOf("@TestAnnot(\"") + "@TestAnnot(\"".length(); >+ >+ CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); >+ >+ assertResults( >+ "completion offset="+(cursorLocation)+"\n" + >+ "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + >+ "completion token=\"\"\n" + >+ "completion token kind=TOKEN_KIND_STRING_LITERAL\n" + >+ "expectedTypesSignatures=null\n" + >+ "expectedTypesKeys=null\n" + >+ "completion token location=UNKNOWN", >+ result.context); >+} > } >#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.206 >diff -u -r1.206 CompletionParser.java >--- codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java 16 Apr 2009 13:34:36 -0000 1.206 >+++ codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java 5 May 2009 14:08:20 -0000 >@@ -386,7 +386,7 @@ > > buildMoreAnnotationCompletionContext(memberValueName); > return; >- } else if (expression instanceof QualifiedNameReference) { >+ } else if (expression instanceof QualifiedNameReference || expression instanceof StringLiteral) { > MemberValuePair valuePair = > new MemberValuePair(VALUE, expression.sourceStart, expression.sourceEnd, expression); > buildMoreAnnotationCompletionContext(valuePair); >#P org.eclipse.jdt.core.tests.compiler >Index: src/org/eclipse/jdt/core/tests/compiler/parser/GenericsCompletionParserTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/GenericsCompletionParserTest.java,v >retrieving revision 1.38 >diff -u -r1.38 GenericsCompletionParserTest.java >--- src/org/eclipse/jdt/core/tests/compiler/parser/GenericsCompletionParserTest.java 28 Apr 2009 17:17:30 -0000 1.38 >+++ src/org/eclipse/jdt/core/tests/compiler/parser/GenericsCompletionParserTest.java 5 May 2009 14:08:22 -0000 >@@ -11063,4 +11063,70 @@ > expectedReplacedSource, > "diet ast"); > } >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=274557 >+public void test0219_Diet() { >+ >+ String str = >+ "public class X {\n" + >+ " @Annot(value=\"\")\n" + >+ " int field;\n" + >+ "}\n"; >+ >+ String completeBehind = "value=\""; >+ int cursorLocation = str.lastIndexOf("value=\"") + completeBehind.length() - 1; >+ String expectedCompletionNodeToString = "<CompletionOnString:\"\">"; >+ String expectedParentNodeToString = "<NONE>"; >+ String completionIdentifier = ""; >+ String expectedReplacedSource = "\"\""; >+ String expectedUnitDisplayString = >+ "public class X {\n" + >+ " @Annot(value = <CompletionOnString:\"\">)\n" + >+ " int field;\n" + >+ " public X() {\n" + >+ " }\n" + >+ "}\n"; >+ >+ checkDietParse( >+ str.toCharArray(), >+ cursorLocation, >+ expectedCompletionNodeToString, >+ expectedParentNodeToString, >+ expectedUnitDisplayString, >+ completionIdentifier, >+ expectedReplacedSource, >+ "diet ast"); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=274557 >+public void test0220_Diet() { >+ >+ String str = >+ "public class X {\n" + >+ " @Annot(\"\")\n" + >+ " int field;\n" + >+ "}\n"; >+ >+ String completeBehind = "@Annot(\""; >+ int cursorLocation = str.lastIndexOf("@Annot(\"") + completeBehind.length() - 1; >+ String expectedCompletionNodeToString = "<CompletionOnString:\"\">"; >+ String expectedParentNodeToString = "<NONE>"; >+ String completionIdentifier = ""; >+ String expectedReplacedSource = "\"\""; >+ String expectedUnitDisplayString = >+ "public class X {\n" + >+ " @Annot(value = <CompletionOnString:\"\">)\n" + >+ " int field;\n" + >+ " public X() {\n" + >+ " }\n" + >+ "}\n"; >+ >+ checkDietParse( >+ str.toCharArray(), >+ cursorLocation, >+ expectedCompletionNodeToString, >+ expectedParentNodeToString, >+ expectedUnitDisplayString, >+ completionIdentifier, >+ expectedReplacedSource, >+ "diet ast"); >+} > }
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 274557
:
133975
|
133976
| 134427