### 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.159 diff -u -r1.159 CompletionParser.java --- codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java 10 Oct 2006 10:19:01 -0000 1.159 +++ codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java 12 Oct 2006 13:58:02 -0000 @@ -324,8 +324,19 @@ if(this.genericsPtr > -1) { ASTNode node = this.genericsStack[this.genericsPtr]; if(node instanceof Wildcard && ((Wildcard)node).bound == this.assistNode){ - buildMoreGenericsCompletionContext(node); - return; + int kind = topKnownElementKind(COMPLETION_OR_ASSIST_PARSER); + if (kind == K_BINARY_OPERATOR) { + int info = topKnownElementInfo(COMPLETION_OR_ASSIST_PARSER); + if (info == LESS) { + buildMoreGenericsCompletionContext(node, true); + return; + } + } + if(this.identifierLengthPtr > -1 && this.identifierLengthStack[this.identifierLengthPtr]!= 0) { + this.pushOnElementStack(K_BINARY_OPERATOR, LESS); + buildMoreGenericsCompletionContext(node, false); + return; + } } } @@ -406,7 +417,7 @@ } } if(node == this.assistNode){ - buildMoreGenericsCompletionContext(node); + buildMoreGenericsCompletionContext(node, true); } } } @@ -854,7 +865,7 @@ } } } -private void buildMoreGenericsCompletionContext(ASTNode node) { +private void buildMoreGenericsCompletionContext(ASTNode node, boolean consumeTypeArguments) { int kind = topKnownElementKind(COMPLETION_OR_ASSIST_PARSER); if(kind != 0) { int info = topKnownElementInfo(COMPLETION_OR_ASSIST_PARSER); @@ -875,7 +886,7 @@ } if(info == LESS && node instanceof TypeReference) { if(this.identifierLengthPtr > -1 && this.identifierLengthStack[this.identifierLengthPtr]!= 0) { - this.consumeTypeArguments(); + if (consumeTypeArguments) this.consumeTypeArguments(); TypeReference ref = this.getTypeReference(0); if(prevKind == K_PARAMETERIZED_CAST) { ref = computeQualifiedGenericsFromRightSide(ref, 0); #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.25 diff -u -r1.25 GenericsCompletionParserTest.java --- src/org/eclipse/jdt/core/tests/compiler/parser/GenericsCompletionParserTest.java 20 Apr 2006 11:53:38 -0000 1.25 +++ src/org/eclipse/jdt/core/tests/compiler/parser/GenericsCompletionParserTest.java 12 Oct 2006 13:58:06 -0000 @@ -9393,4 +9393,33 @@ expectedReplacedSource, "diet ast"); } +public void test0212(){ + String str = + "public class Test {\n" + + " List\n" + + "}\n"; + + String completeBehind = "Obj"; + int cursorLocation = str.indexOf("Obj") + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = ""; + String completionIdentifier = "Obj"; + String expectedReplacedSource = "Obj"; + String expectedUnitDisplayString = + "public class Test {\n" + + " List>;\n" + + " public Test() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} }