### 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.199 diff -u -r1.199 CompletionParser.java --- codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java 10 Oct 2008 07:28:57 -0000 1.199 +++ codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java 20 Oct 2008 15:05:06 -0000 @@ -3370,9 +3370,22 @@ if(topKnownElementKind(COMPLETION_OR_ASSIST_PARSER) != K_ARRAY_CREATION) { pushOnElementStack(K_BETWEEN_LEFT_AND_RIGHT_BRACKET); } else { - if(previous == TokenNameIdentifier) { - this.invocationType = NO_RECEIVER; - this.qualifier = -1; + switch (previous) { + case TokenNameIdentifier: + case TokenNameboolean: + case TokenNamebyte: + case TokenNamechar: + case TokenNamedouble: + case TokenNamefloat: + case TokenNameint: + case TokenNamelong: + case TokenNameshort: + case TokenNameGREATER: + case TokenNameRIGHT_SHIFT: + case TokenNameUNSIGNED_RIGHT_SHIFT: + this.invocationType = NO_RECEIVER; + this.qualifier = -1; + break; } } break; #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.189 diff -u -r1.189 CompletionTests.java --- src/org/eclipse/jdt/core/tests/model/CompletionTests.java 10 Oct 2008 07:29:03 -0000 1.189 +++ src/org/eclipse/jdt/core/tests/model/CompletionTests.java 20 Oct 2008 15:05:10 -0000 @@ -115,6 +115,32 @@ } } +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=246276 +public void testArrayInitializer1() throws JavaModelException { + this.workingCopies = new ICompilationUnit[1]; + this.workingCopies[0] = getWorkingCopy( + "/Completion/src/ArrayInitializer.java", + "public class ArrayInitializer {\n"+ + " int bar() {return 0;}\n"+ + " void foo(int[] i) {\n"+ + " i = new int[] {\n"+ + " bar()\n"+ + " };\n"+ + " }\n"+ + "}\n"); + + CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); + + String str = this.workingCopies[0].getSource(); + String completeBehind = "bar("; + int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); + this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); + + assertResults( + "bar[METHOD_REF]{, LArrayInitializer;, ()I, bar, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", + requestor.getResults()); +} + //https://bugs.eclipse.org/bugs/show_bug.cgi?id=164311 public void testBug164311() throws JavaModelException { this.workingCopies = new ICompilationUnit[1];