### 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.157.4.2 diff -u -r1.157.4.2 CompletionParser.java --- codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java 20 Nov 2006 14:06:08 -0000 1.157.4.2 +++ codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java 15 Dec 2006 14:05:07 -0000 @@ -2658,8 +2658,14 @@ case TokenNameRIGHT_SHIFT: // or fred>[(]1, 2) case TokenNameUNSIGNED_RIGHT_SHIFT: //or Fred>>[(]1, 2) if (topKnownElementKind(COMPLETION_OR_ASSIST_PARSER) == K_SELECTOR) { - this.pushOnElementStack(K_SELECTOR_INVOCATION_TYPE, (this.invocationType == QUALIFIED_ALLOCATION) ? QUALIFIED_ALLOCATION : ALLOCATION); - this.pushOnElementStack(K_SELECTOR_QUALIFIER, this.qualifier); + if (topKnownElementKind(COMPLETION_OR_ASSIST_PARSER, 1) == K_BINARY_OPERATOR && + topKnownElementInfo(COMPLETION_OR_ASSIST_PARSER, 1) == GREATER) { + // it's not a selector invocation + popElement(K_SELECTOR); + } else { + this.pushOnElementStack(K_SELECTOR_INVOCATION_TYPE, (this.invocationType == QUALIFIED_ALLOCATION) ? QUALIFIED_ALLOCATION : ALLOCATION); + this.pushOnElementStack(K_SELECTOR_QUALIFIER, this.qualifier); + } } this.qualifier = -1; this.invocationType = NO_RECEIVER; #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.122.2.1 diff -u -r1.122.2.1 CompletionTests.java --- src/org/eclipse/jdt/core/tests/model/CompletionTests.java 2 Jul 2006 10:06:40 -0000 1.122.2.1 +++ src/org/eclipse/jdt/core/tests/model/CompletionTests.java 15 Dec 2006 14:05:15 -0000 @@ -11685,6 +11685,65 @@ } } } +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=164311 +public void testBug164311() throws JavaModelException { + this.workingCopies = new ICompilationUnit[1]; + this.workingCopies[0] = getWorkingCopy( + "/Completion/src/test/Test.java", + "package test;"+ + "public class Test {\n" + + " public int zzzzzz;\n" + + " public void method1() {\n" + + " label : if (0> (10));\n" + + " zzz\n" + + " }\n" + + "}\n"); + + CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); + String str = this.workingCopies[0].getSource(); + String completeBehind = "zzz"; + int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); + this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); + + assertResults( + "zzzzzz[FIELD_REF]{zzzzzz, Ltest.Test;, I, zzzzzz, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", + requestor.getResults()); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=164311 +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=167750 +public void testBug164311_2() throws JavaModelException { + this.workingCopies = new ICompilationUnit[1]; + this.workingCopies[0] = getWorkingCopy( + "/Completion/src/test/Test.java", + "package test;\n"+ + "public class X {\n"+ + " public void zork() { \n"+ + " } \n"+ + " public void foo() { \n"+ + " this.foo(new Object(){\n"+ + " public void bar() {\n"+ + " if (zzz>(Integer)vvv.foo(i)) {\n"+ + " return;\n"+ + " }\n"+ + " if (true) {\n"+ + " return;\n"+ + " }\n"+ + " zor\n"+ + " } \n"+ + " });\n"+ + " }\n"+ + "}\n"); + + CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); + String str = this.workingCopies[0].getSource(); + String completeBehind = "zor"; + int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); + this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); + + assertResults( + "zork[METHOD_REF]{zork(), Ltest.X;, ()V, zork, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", + requestor.getResults()); +} public void testCompletionImportedType1() throws JavaModelException { this.workingCopies = new ICompilationUnit[2]; this.workingCopies[0] = getWorkingCopy(