### 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.410 diff -u -r1.410 CompletionEngine.java --- codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java 7 Jan 2010 20:18:50 -0000 1.410 +++ codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java 4 Mar 2010 09:12:13 -0000 @@ -7449,8 +7449,13 @@ } private void findImportsOfStaticFields(char[] fieldName, ReferenceBinding ref) { - FieldBinding[] fields = ref.availableFields(); - + FieldBinding[] fields; + if (ref.isRawType()) { + fields = ((RawTypeBinding) ref).genericType().availableFields(); + } else { + fields = ref.availableFields(); + } + int fieldLength = fieldName.length; next : for (int m = fields.length; --m >= 0;) { FieldBinding field = fields[m]; #P org.eclipse.jdt.core.tests.model Index: src/org/eclipse/jdt/core/tests/model/CompletionTests_1_5.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests_1_5.java,v retrieving revision 1.118 diff -u -r1.118 CompletionTests_1_5.java --- src/org/eclipse/jdt/core/tests/model/CompletionTests_1_5.java 9 Jul 2009 10:47:24 -0000 1.118 +++ src/org/eclipse/jdt/core/tests/model/CompletionTests_1_5.java 4 Mar 2010 09:14:07 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -13790,5 +13790,90 @@ (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED) + "}", requestor.getResults()); } +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=204100 +// To verify that the declaration signature for a proposal in +// static import is the generic signature +public void testBug204100a() throws JavaModelException { + this.oldOptions = JavaCore.getOptions(); + try { + Hashtable options = new Hashtable(this.oldOptions); + options.put(JavaCore.CODEASSIST_SUGGEST_STATIC_IMPORTS, JavaCore.ENABLED); + JavaCore.setOptions(options); + this.workingCopies = new ICompilationUnit[2]; + this.workingCopies[0] = getWorkingCopy( + "/Completion/src3/test/pack/AClass.java", + "package test.pack;\n"+ + "public class AClass {\n" + + " public static int zork;\n" + + "}\n"); + + this.workingCopies[1] = getWorkingCopy( + "/Completion/src3/test/Test.java", + "package test;\n" + + "import static test.pack.AClass.;\n" + + "public class Test {\n" + + " public void bar() {\n" + + " }\n" + + "}\n"); + + CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); + requestor.allowAllRequiredProposals(); + String str = this.workingCopies[1].getSource(); + String completeBehind = "test.pack.AClass."; + int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); + this.workingCopies[1].codeComplete(cursorLocation, requestor, this.wcOwner); + assertResults( + "zork[FIELD_REF]{zork;, Ltest.pack.AClass;, I, zork, null, " + + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", + requestor.getResults()); + } + finally { + JavaCore.setOptions(this.oldOptions); + } +} +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=204100 +// To verify that the declaration signature for a proposal in +// static import is the generic signature +public void testBug204100b() throws JavaModelException { + this.oldOptions = JavaCore.getOptions(); + try { + Hashtable options = new Hashtable(this.oldOptions); + options.put(JavaCore.CODEASSIST_SUGGEST_STATIC_IMPORTS, JavaCore.ENABLED); + JavaCore.setOptions(options); + this.workingCopies = new ICompilationUnit[2]; + this.workingCopies[0] = getWorkingCopy( + "/Completion/src3/test/pack/AClass.java", + "package test.pack;\n" + + "class ABC {\n" + + " int aField;\n" + + "}\n"+ + "public class AClass {\n" + + " public static ABC abc;\n" + + "}\n"); + + this.workingCopies[1] = getWorkingCopy( + "/Completion/src3/test/Test.java", + "package test;\n" + + "import static test.pack.AClass.;\n" + + "public class Test {\n" + + " public void bar() {\n" + + " }\n" + + "}\n"); + + CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); + requestor.allowAllRequiredProposals(); + String str = this.workingCopies[1].getSource(); + String completeBehind = "test.pack.AClass."; + int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); + this.workingCopies[1].codeComplete(cursorLocation, requestor, this.wcOwner); + assertResults( + "abc[FIELD_REF]{abc;, Ltest.pack.AClass;, Ltest.pack.ABC;, abc, null, " + + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", + requestor.getResults()); + } + finally { + JavaCore.setOptions(this.oldOptions); + } +} }