### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core.tests.model Index: workspace/Completion/src3/test0061/Test.java =================================================================== RCS file: workspace/Completion/src3/test0061/Test.java diff -N workspace/Completion/src3/test0061/Test.java --- workspace/Completion/src3/test0061/Test.java 19 Oct 2004 09:26:40 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,7 +0,0 @@ -package test0061; -import static pkgstaticimport.QQType4.zzvarzz2; -public class Test { - void foo() { - zzvarzz - } -} Index: workspace/Completion/src3/test0058/Test.java =================================================================== RCS file: workspace/Completion/src3/test0058/Test.java diff -N workspace/Completion/src3/test0058/Test.java --- workspace/Completion/src3/test0058/Test.java 19 Oct 2004 09:26:40 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,7 +0,0 @@ -package test0058; -import static pkgstaticimport.QQType4.*; -public class Test { - void foo() { - zzvarzz - } -} Index: workspace/Completion/src3/test0063/Test.java =================================================================== RCS file: workspace/Completion/src3/test0063/Test.java diff -N workspace/Completion/src3/test0063/Test.java --- workspace/Completion/src3/test0063/Test.java 19 Oct 2004 09:26:40 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,8 +0,0 @@ -package test0061; -import static pkgstaticimport.QQType4.zzvarzz2; -import static pkgstaticimport.QQType4.*; -public class Test { - void foo() { - zzvarzz - } -} Index: workspace/Completion/src3/test0065/Test.java =================================================================== RCS file: workspace/Completion/src3/test0065/Test.java diff -N workspace/Completion/src3/test0065/Test.java --- workspace/Completion/src3/test0065/Test.java 19 Oct 2004 09:26:40 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,7 +0,0 @@ -package test0065; -import static pkgstaticimport.QQType7.*; -public class Test { - void foo() { - zzfoozz - } -} 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.123 diff -u -r1.123 CompletionTests.java --- src/org/eclipse/jdt/core/tests/model/CompletionTests.java 8 Jun 2006 13:09:32 -0000 1.123 +++ src/org/eclipse/jdt/core/tests/model/CompletionTests.java 5 Jul 2006 08:26:30 -0000 @@ -232,8 +232,8 @@ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); assertResults( - "foo1[METHOD_REF]{foo1(), Ldeprecation.ZZZType1;, ()V, foo1, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + - "foo2[METHOD_REF]{foo2(), Ldeprecation.ZZZType1;, ()V, foo2, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", + "foo1[METHOD_REF]{foo1(), Ldeprecation.ZZZType1;, ()V, foo1, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_INHERITED + R_NON_RESTRICTED) + "}\n" + + "foo2[METHOD_REF]{foo2(), Ldeprecation.ZZZType1;, ()V, foo2, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_INHERITED + R_NON_RESTRICTED) + "}", requestor.getResults()); } finally { options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, timeout); @@ -274,7 +274,7 @@ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); assertResults( - "foo1[METHOD_REF]{foo1(), Ldeprecation.ZZZType1;, ()V, foo1, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", + "foo1[METHOD_REF]{foo1(), Ldeprecation.ZZZType1;, ()V, foo1, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_INHERITED + R_NON_RESTRICTED) + "}", requestor.getResults()); } finally { options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, timeout); @@ -394,8 +394,8 @@ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); assertResults( - "foo1[FIELD_REF]{foo1, Ldeprecation.ZZZType1;, I, foo1, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + - "foo2[FIELD_REF]{foo2, Ldeprecation.ZZZType1;, I, foo2, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", + "foo1[FIELD_REF]{foo1, Ldeprecation.ZZZType1;, I, foo1, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_INHERITED + R_NON_RESTRICTED) + "}\n" + + "foo2[FIELD_REF]{foo2, Ldeprecation.ZZZType1;, I, foo2, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_INHERITED + R_NON_RESTRICTED) + "}", requestor.getResults()); } finally { options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, timeout); @@ -436,7 +436,7 @@ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); assertResults( - "foo1[FIELD_REF]{foo1, Ldeprecation.ZZZType1;, I, foo1, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", + "foo1[FIELD_REF]{foo1, Ldeprecation.ZZZType1;, I, foo1, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_INHERITED + R_NON_RESTRICTED) + "}", requestor.getResults()); } finally { options.put(JavaCore.CODEASSIST_DEPRECATION_CHECK, timeout); @@ -1685,7 +1685,7 @@ this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); assertResults( - "B1.Inner1[TYPE_REF]{Inner1, , LB1$Inner1;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED) +"}", + "B1.Inner1[TYPE_REF]{Inner1, , LB1$Inner1;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_INHERITED + R_NON_RESTRICTED) +"}", requestor.getResults()); } @@ -4042,7 +4042,7 @@ cu.codeComplete(cursorLocation, requestor); assertEquals( - "element:this completion:this relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), + "element:this completion:this relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_INHERITED + R_NON_RESTRICTED), requestor.getResults()); } public void testCompletionKeywordThis7() throws JavaModelException { @@ -6626,7 +6626,7 @@ cu.codeComplete(cursorLocation, requestor); assertEquals( - "element:this completion:this relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), + "element:this completion:this relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_INHERITED + R_NON_RESTRICTED), requestor.getResults()); } public void testCompletionKeywordThis14() throws JavaModelException { @@ -6664,9 +6664,9 @@ this.wc.codeComplete(cursorLocation, requestor, this.wcOwner); assertResults( - "CompletionKeywordThis15.InnerClass[TYPE_REF]{InnerClass, , LCompletionKeywordThis15$InnerClass;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + - "class[FIELD_REF]{class, null, Ljava.lang.Class;, class, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n"+ - "this[KEYWORD]{this, null, null, this, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", + "CompletionKeywordThis15.InnerClass[TYPE_REF]{InnerClass, , LCompletionKeywordThis15$InnerClass;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_INHERITED + R_NON_RESTRICTED) + "}\n" + + "class[FIELD_REF]{class, null, Ljava.lang.Class;, class, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_INHERITED + R_NON_RESTRICTED) + "}\n"+ + "this[KEYWORD]{this, null, null, this, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_INHERITED + R_NON_RESTRICTED) + "}", requestor.getResults()); } public void testCompletionKeywordSuper7() throws JavaModelException { @@ -9992,7 +9992,7 @@ cu.codeComplete(cursorLocation, requestor); assertEquals( - "element:class completion:class relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), + "element:class completion:class relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_INHERITED + R_NON_RESTRICTED), requestor.getResults()); } public void testCompletionArraysCloneMethod() throws JavaModelException { @@ -12390,4 +12390,53 @@ "label2[LABEL_REF]{label2, null, null, label2, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", requestor.getResults()); } +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=22072 +public void testStaticMembers1() throws JavaModelException { + this.workingCopies = new ICompilationUnit[3]; + this.workingCopies[0] = getWorkingCopy( + "/Completion/src/test/Test.java", + "package test;"+ + "public class Test {\n" + + " void foo() {\n" + + " StaticMembers.\n" + + " }\n" + + "}\n"); + + this.workingCopies[1] = getWorkingCopy( + "/Completion/src/test/StaticMembers.java", + "package test;"+ + "public class StaticMembers extends SuperStaticMembers {\n" + + " public static int staticField;\n" + + " public static int staticMethod() {}\n" + + " public class Clazz {}\n" + + " public static class StaticClazz {}\n" + + "}\n"); + + this.workingCopies[2] = getWorkingCopy( + "/Completion/src/test/SuperStaticMembers.java", + "package test;"+ + "public class SuperStaticMembers {\n" + + " public static int superStaticField;\n" + + " public static int supeStaticMethod() {}\n" + + " public class SuperClazz {}\n" + + " public static class SuperStaticClazz {}\n" + + "}\n"); + + CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); + String str = this.workingCopies[0].getSource(); + String completeBehind = "StaticMembers."; + int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); + this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); + + assertResults( + "supeStaticMethod[METHOD_REF]{supeStaticMethod(), Ltest.SuperStaticMembers;, ()I, supeStaticMethod, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + + "superStaticField[FIELD_REF]{superStaticField, Ltest.SuperStaticMembers;, I, superStaticField, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + + "StaticMembers.Clazz[TYPE_REF]{Clazz, test, Ltest.StaticMembers$Clazz;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_INHERITED + R_NON_RESTRICTED) + "}\n" + + "StaticMembers.StaticClazz[TYPE_REF]{StaticClazz, test, Ltest.StaticMembers$StaticClazz;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_INHERITED + R_NON_RESTRICTED) + "}\n" + + "class[FIELD_REF]{class, null, Ljava.lang.Class;, class, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_INHERITED + R_NON_RESTRICTED) + "}\n" + + "staticField[FIELD_REF]{staticField, Ltest.StaticMembers;, I, staticField, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_INHERITED + R_NON_RESTRICTED) + "}\n" + + "staticMethod[METHOD_REF]{staticMethod(), Ltest.StaticMembers;, ()I, staticMethod, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_INHERITED + R_NON_RESTRICTED) + "}\n" + + "this[KEYWORD]{this, null, null, this, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_INHERITED + R_NON_RESTRICTED) + "}", + requestor.getResults()); +} } 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.67 diff -u -r1.67 CompletionTests_1_5.java --- src/org/eclipse/jdt/core/tests/model/CompletionTests_1_5.java 25 Apr 2006 13:31:15 -0000 1.67 +++ src/org/eclipse/jdt/core/tests/model/CompletionTests_1_5.java 5 Jul 2006 08:26:34 -0000 @@ -1519,17 +1519,27 @@ qqTypes = this.getExternalQQTypes(); + this.workingCopies = new ICompilationUnit[1]; + this.workingCopies[0] = getWorkingCopy( + "/Completion/src3/test0058/Test.java", + "package test0058;\n"+ + "import static pkgstaticimport.QQType4.*;\n"+ + "public class Test {\n"+ + " void foo() {\n"+ + " zzvarzz\n"+ + " }\n"+ + "}"); + CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); - ICompilationUnit cu= getCompilationUnit("Completion", "src3", "test0058", "Test.java"); - - String str = cu.getSource(); + String str = this.workingCopies[0].getSource(); String completeBehind = "zzvarzz"; int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor, this.wcOwner); - + this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); + assertResults( "zzvarzz2[FIELD_REF]{zzvarzz2, Lpkgstaticimport.QQType4;, I, zzvarzz2, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", requestor.getResults()); + } finally { this.discardWorkingCopies(qqTypes); @@ -1562,15 +1572,24 @@ " int zzvarzz7;\n"+ " static int zzvarzz8;\n"+ "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); - ICompilationUnit cu= getCompilationUnit("Completion", "src3", "test0059", "Test.java"); - String str = cu.getSource(); + this.workingCopies = new ICompilationUnit[1]; + this.workingCopies[0] = getWorkingCopy( + "/Completion/src3/test0059/Test.java", + "package test0059;\n"+ + "import static test0059.QQType5.*;\n"+ + "public class Test {\n"+ + " void foo() {\n"+ + " zzvarzz\n"+ + " }\n"+ + "}"); + + CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); + String str = this.workingCopies[0].getSource(); String completeBehind = "zzvarzz"; int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor, this.wcOwner); - + this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); + assertResults( "zzvarzz2[FIELD_REF]{zzvarzz2, Ltest0059.QQType5;, I, zzvarzz2, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + "zzvarzz4[FIELD_REF]{zzvarzz4, Ltest0059.QQType5;, I, zzvarzz4, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + @@ -1626,13 +1645,22 @@ qqTypes = this.getExternalQQTypes(); + this.workingCopies = new ICompilationUnit[1]; + this.workingCopies[0] = getWorkingCopy( + "/Completion/src3/test0061/Test.java", + "package test0061;\n" + + "import static pkgstaticimport.QQType4.zzvarzz2;\n" + + "public class Test {\n" + + " void foo() {\n" + + " zzvarzz\n" + + " }\n" + + "}"); + CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); - ICompilationUnit cu= getCompilationUnit("Completion", "src3", "test0061", "Test.java"); - - String str = cu.getSource(); + String str = this.workingCopies[0].getSource(); String completeBehind = "zzvarzz"; int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor, this.wcOwner); + this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); assertResults( "zzvarzz2[FIELD_REF]{zzvarzz2, Lpkgstaticimport.QQType4;, I, zzvarzz2, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", @@ -1654,13 +1682,23 @@ qqTypes = this.getExternalQQTypes(); + this.workingCopies = new ICompilationUnit[1]; + this.workingCopies[0] = getWorkingCopy( + "/Completion/src3/test0062/Test.java", + "package test0062;\n" + + "import static pkgstaticimport.QQType4.*;\n" + + "import static pkgstaticimport.QQType4.zzvarzz2;\n" + + "public class Test {\n" + + " void foo() {\n" + + " zzvarzz\n" + + " }\n" + + "}"); + CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); - ICompilationUnit cu= getCompilationUnit("Completion", "src3", "test0062", "Test.java"); - - String str = cu.getSource(); + String str = this.workingCopies[0].getSource(); String completeBehind = "zzvarzz"; int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor, this.wcOwner); + this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); assertResults( "zzvarzz2[FIELD_REF]{zzvarzz2, Lpkgstaticimport.QQType4;, I, zzvarzz2, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", @@ -1682,13 +1720,23 @@ qqTypes = this.getExternalQQTypes(); + this.workingCopies = new ICompilationUnit[1]; + this.workingCopies[0] = getWorkingCopy( + "/Completion/src3/test0063/Test.java", + "package test0063;\n" + + "import static pkgstaticimport.QQType4.zzvarzz2;\n" + + "import static pkgstaticimport.QQType4.*;\n" + + "public class Test {\n" + + " void foo() {\n" + + " zzvarzz\n" + + " }\n" + + "}"); + CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); - ICompilationUnit cu= getCompilationUnit("Completion", "src3", "test0063", "Test.java"); - - String str = cu.getSource(); + String str = this.workingCopies[0].getSource(); String completeBehind = "zzvarzz"; int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor, this.wcOwner); + this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); assertResults( "zzvarzz2[FIELD_REF]{zzvarzz2, Lpkgstaticimport.QQType4;, I, zzvarzz2, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", @@ -1737,15 +1785,24 @@ JavaCore.setOptions(options); qqTypes = this.getExternalQQTypes(); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); - ICompilationUnit cu= getCompilationUnit("Completion", "src3", "test0065", "Test.java"); - String str = cu.getSource(); + this.workingCopies = new ICompilationUnit[1]; + this.workingCopies[0] = getWorkingCopy( + "/Completion/src3/test0065/Test.java", + "package test0065;\n" + + "import static pkgstaticimport.QQType7.*;\n" + + "public class Test {\n" + + " void foo() {\n" + + " zzfoozz\n" + + " }\n" + + "}"); + + CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); + String str = this.workingCopies[0].getSource(); String completeBehind = "zzfoozz"; int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor, this.wcOwner); - + this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); + assertResults( "zzfoozz2[METHOD_REF]{zzfoozz2(), Lpkgstaticimport.QQType7;, ()V, zzfoozz2, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", requestor.getResults()); @@ -1781,15 +1838,24 @@ " void zzfoozz7(){};\n"+ " static void zzfoozz8(){};\n"+ "}"); - - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); - ICompilationUnit cu= getCompilationUnit("Completion", "src3", "test0066", "Test.java"); - String str = cu.getSource(); + this.workingCopies = new ICompilationUnit[1]; + this.workingCopies[0] = getWorkingCopy( + "/Completion/src3/test0066/Test.java", + "package test0066;\n" + + "import static test0066.QQType8.*;\n" + + "public class Test {\n" + + " void foo() {\n" + + " zzfoozz\n" + + " }\n" + + "}"); + + CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); + String str = this.workingCopies[0].getSource(); String completeBehind = "zzfoozz"; int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); - cu.codeComplete(cursorLocation, requestor, this.wcOwner); - + this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); + assertResults( "zzfoozz2[METHOD_REF]{zzfoozz2(), Ltest0066.QQType8;, ()V, zzfoozz2, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + "zzfoozz4[METHOD_REF]{zzfoozz4(), Ltest0066.QQType8;, ()V, zzfoozz4, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + @@ -7303,7 +7369,7 @@ result.context); assertResults( - "class[FIELD_REF]{class, null, Ljava.lang.Class;, class, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", + "class[FIELD_REF]{class, null, Ljava.lang.Class;, class, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_INHERITED + R_NON_RESTRICTED) + "}", result.proposals); } /* @@ -7328,7 +7394,7 @@ result.context); assertResults( - "class[FIELD_REF]{class, null, Ljava.lang.Class;, class, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", + "class[FIELD_REF]{class, null, Ljava.lang.Class;, class, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_INHERITED + R_NON_RESTRICTED) + "}", result.proposals); } // https://bugs.eclipse.org/bugs/show_bug.cgi?id=96944 @@ -8224,7 +8290,7 @@ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); assertResults( - "zzz2[METHOD_REF]{zzz2(), Ltest.TestCollections;, (Ljava.lang.Object;)V, zzz2, (t), " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", + "zzz2[METHOD_REF]{zzz2(), Ltest.TestCollections;, (Ljava.lang.Object;)V, zzz2, (t), " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_INHERITED + R_NON_RESTRICTED) + "}", requestor.getResults()); } // https://bugs.eclipse.org/bugs/show_bug.cgi?id=106450 @@ -8443,7 +8509,7 @@ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); assertResults( - "zzz2[METHOD_REF]{zzz2(), Ltest.Test;, (Ljava.lang.Object;)V, zzz2, (t), " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", + "zzz2[METHOD_REF]{zzz2(), Ltest.Test;, (Ljava.lang.Object;)V, zzz2, (t), " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_INHERITED + R_NON_RESTRICTED) + "}", requestor.getResults()); } // https://bugs.eclipse.org/bugs/show_bug.cgi?id=106450 @@ -8474,7 +8540,7 @@ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); assertResults( - "zzz2[METHOD_REF]{zzz2(), Ltest.TestCollections;, (Ljava.lang.Object;)V, zzz2, (t), " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", + "zzz2[METHOD_REF]{zzz2(), Ltest.TestCollections;, (Ljava.lang.Object;)V, zzz2, (t), " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_INHERITED + R_NON_RESTRICTED) + "}", requestor.getResults()); } // https://bugs.eclipse.org/bugs/show_bug.cgi?id=106450 @@ -8536,7 +8602,7 @@ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); assertResults( - "zzz2[METHOD_REF]{zzz2(), Ltest.TestCollections;, (TT;)V, zzz2, (t), " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", + "zzz2[METHOD_REF]{zzz2(), Ltest.TestCollections;, (TT;)V, zzz2, (t), " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_INHERITED + R_NON_RESTRICTED) + "}", requestor.getResults()); } // https://bugs.eclipse.org/bugs/show_bug.cgi?id=106450 @@ -8617,7 +8683,7 @@ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); assertResults( - "zzz2[METHOD_REF]{zzz2(), Ltest.Test;, (Ljava.lang.Object;)V, zzz2, (t), " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", + "zzz2[METHOD_REF]{zzz2(), Ltest.Test;, (Ljava.lang.Object;)V, zzz2, (t), " + (R_DEFAULT + R_INTERESTING + R_CASE + R_NON_INHERITED + R_NON_RESTRICTED) + "}", requestor.getResults()); } // https://bugs.eclipse.org/bugs/show_bug.cgi?id=133491 Index: workspace/Completion/src3/test0062/Test.java =================================================================== RCS file: workspace/Completion/src3/test0062/Test.java diff -N workspace/Completion/src3/test0062/Test.java --- workspace/Completion/src3/test0062/Test.java 19 Oct 2004 09:26:40 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,8 +0,0 @@ -package test0062; -import static pkgstaticimport.QQType4.*; -import static pkgstaticimport.QQType4.zzvarzz2; -public class Test { - void foo() { - zzvarzz - } -} Index: workspace/Completion/src3/test0066/Test.java =================================================================== RCS file: workspace/Completion/src3/test0066/Test.java diff -N workspace/Completion/src3/test0066/Test.java --- workspace/Completion/src3/test0066/Test.java 19 Oct 2004 09:26:40 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,7 +0,0 @@ -package test0066; -import static test0066.QQType8.*; -public class Test { - void foo() { - zzfoozz - } -} Index: workspace/Completion/src3/test0059/Test.java =================================================================== RCS file: workspace/Completion/src3/test0059/Test.java diff -N workspace/Completion/src3/test0059/Test.java --- workspace/Completion/src3/test0059/Test.java 19 Oct 2004 09:26:40 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,7 +0,0 @@ -package test0059; -import static test0059.QQType5.*; -public class Test { - void foo() { - zzvarzz - } -} #P org.eclipse.jdt.core Index: codeassist/org/eclipse/jdt/internal/codeassist/RelevanceConstants.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/RelevanceConstants.java,v retrieving revision 1.28 diff -u -r1.28 RelevanceConstants.java --- codeassist/org/eclipse/jdt/internal/codeassist/RelevanceConstants.java 28 Mar 2006 20:30:02 -0000 1.28 +++ codeassist/org/eclipse/jdt/internal/codeassist/RelevanceConstants.java 5 Jul 2006 08:26:39 -0000 @@ -39,5 +39,5 @@ int R_TRUE_OR_FALSE = 1; int R_INLINE_TAG = 31; int R_VALUE_TAG = 31; - + int R_NON_INHERITED = 2; } 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.292 diff -u -r1.292 CompletionEngine.java --- codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java 28 Apr 2006 14:53:28 -0000 1.292 +++ codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java 5 Jul 2006 08:26:39 -0000 @@ -807,7 +807,7 @@ findTypesAndPackages(this.completionToken, scope); if (!this.requestor.isIgnored(CompletionProposal.KEYWORD)) { if (this.completionToken != null && this.completionToken.length != 0) { - findKeywords(this.completionToken, singleNameReference.possibleKeywords, false); + findKeywords(this.completionToken, singleNameReference.possibleKeywords, false, false); } else { findTrueOrFalseKeywords(singleNameReference.possibleKeywords); } @@ -854,6 +854,7 @@ false, false, false, + false, !this.assistNodeIsConstructor, null, new ObjectVector()); @@ -886,6 +887,7 @@ scope, scope.enclosingSourceType(), false, + true, new ObjectVector()); } if (!this.requestor.isIgnored(CompletionProposal.FIELD_REF)) { @@ -898,12 +900,14 @@ ((scope instanceof MethodScope && !((MethodScope)scope).isStatic) || ((methodScope = scope.enclosingMethodScope()) != null && !methodScope.isStatic))) { if (this.completionToken.length > 0) { - findKeywords(this.completionToken, new char[][]{Keywords.THIS}, false); + findKeywords(this.completionToken, new char[][]{Keywords.THIS}, false, true); } else { int relevance = computeBaseRelevance(); relevance += computeRelevanceForInterestingProposal(); relevance += computeRelevanceForCaseMatching(this.completionToken, Keywords.THIS); relevance += computeRelevanceForRestrictions(IAccessRule.K_ACCESSIBLE); // no access restriction for keywords + relevance += R_NON_INHERITED; + this.noProposal = false; if (!this.requestor.isIgnored(CompletionProposal.KEYWORD)) { CompletionProposal proposal = this.createProposal(CompletionProposal.KEYWORD, this.actualCompletionPosition); @@ -981,6 +985,7 @@ scope, scope.enclosingSourceType(), false, + false, new ObjectVector()); } } else if (qualifiedBinding instanceof PackageBinding) { @@ -998,7 +1003,7 @@ this.completionToken = access.token; if (!this.requestor.isIgnored(CompletionProposal.KEYWORD)) { - findKeywords(this.completionToken, new char[][]{Keywords.NEW}, false); + findKeywords(this.completionToken, new char[][]{Keywords.NEW}, false, false); } findFieldsAndMethods( @@ -1143,7 +1148,7 @@ } else if (astNode instanceof CompletionOnKeyword) { if (!this.requestor.isIgnored(CompletionProposal.KEYWORD)) { CompletionOnKeyword keyword = (CompletionOnKeyword)astNode; - findKeywords(keyword.getToken(), keyword.getPossibleKeywords(), keyword.canCompleteEmptyToken()); + findKeywords(keyword.getToken(), keyword.getPossibleKeywords(), keyword.canCompleteEmptyToken(), false); } } else if (astNode instanceof CompletionOnParameterizedQualifiedTypeReference) { if (!this.requestor.isIgnored(CompletionProposal.TYPE_REF)) { @@ -1164,6 +1169,7 @@ scope, scope.enclosingSourceType(), false, + false, new ObjectVector()); } } else if (astNode instanceof CompletionOnMarkerAnnotationName) { @@ -1196,6 +1202,7 @@ scope, scope.enclosingSourceType(), false, + false, new ObjectVector()); } } @@ -1305,6 +1312,7 @@ scope, scope.enclosingSourceType(), false, + false, new ObjectVector()); } } else if (qualifiedBinding instanceof PackageBinding) { @@ -1723,7 +1731,7 @@ if(!this.requestor.isIgnored(CompletionProposal.KEYWORD)) { setSourceRange(importReference.sourceStart, importReference.sourceEnd); CompletionOnKeyword keyword = (CompletionOnKeyword)importReference; - findKeywords(keyword.getToken(), keyword.getPossibleKeywords(), false); + findKeywords(keyword.getToken(), keyword.getPossibleKeywords(), false, false); } if(this.noProposal && this.problem != null) { this.requestor.completionFailure(this.problem); @@ -1990,6 +1998,7 @@ relevance += computeRelevanceForCaseMatching(token, classField); relevance += computeRelevanceForExpectingType(scope.getJavaLangClass()); relevance += computeRelevanceForRestrictions(IAccessRule.K_ACCESSIBLE); //no access restriction for class field + relevance += R_NON_INHERITED; this.noProposal = false; if(!this.requestor.isIgnored(CompletionProposal.FIELD_REF)) { @@ -2548,6 +2557,9 @@ relevance += computeRelevanceForStatic(onlyStaticFields, field.isStatic()); relevance += computeRelevanceForQualification(prefixRequired); relevance += computeRelevanceForRestrictions(IAccessRule.K_ACCESSIBLE); + if (onlyStaticFields && this.insideQualifiedReference) { + relevance += computeRelevanceForInheritance(receiverType, field.declaringClass); + } this.noProposal = false; // Standard proposal @@ -3139,7 +3151,7 @@ // what about onDemand types? Ignore them since it does not happen! // import p1.p2.A.*; - private void findKeywords(char[] keyword, char[][] choices, boolean canCompleteEmptyToken) { + private void findKeywords(char[] keyword, char[][] choices, boolean canCompleteEmptyToken, boolean staticFieldsAndMethodOnly) { if(choices == null || choices.length == 0) return; int length = keyword.length; @@ -3152,6 +3164,7 @@ relevance += computeRelevanceForInterestingProposal(); relevance += computeRelevanceForCaseMatching(keyword, choices[i]); relevance += computeRelevanceForRestrictions(IAccessRule.K_ACCESSIBLE); // no access restriction for keywors + if (staticFieldsAndMethodOnly && this.insideQualifiedReference) relevance += R_NON_INHERITED; if(CharOperation.equals(choices[i], Keywords.TRUE) || CharOperation.equals(choices[i], Keywords.FALSE)) { relevance += computeRelevanceForExpectingType(TypeBinding.BOOLEAN); @@ -3291,7 +3304,7 @@ } System.arraycopy(keywords, 0, keywords = new char[count][], 0, count); - findKeywords(token, keywords, false); + findKeywords(token, keywords, false, false); } // Helper method for findMemberTypes(char[], ReferenceBinding, Scope) @@ -3302,6 +3315,7 @@ ReferenceBinding receiverType, SourceTypeBinding invocationType, boolean staticOnly, + boolean staticFieldsAndMethodOnly, boolean fromStaticImport, boolean checkQualification, Scope scope) { @@ -3404,6 +3418,7 @@ if(!insideQualifiedReference) { relevance += computeRelevanceForQualification(isQualified); } + if (staticFieldsAndMethodOnly && this.insideQualifiedReference) relevance += R_NON_INHERITED; // This criterion doesn't concern types and is added to be balanced with field and method relevance. if (memberType.isClass()) { relevance += computeRelevanceForClass(); @@ -3427,6 +3442,7 @@ Scope scope, SourceTypeBinding typeInvocation, boolean staticOnly, + boolean staticFieldsAndMethodOnly, ObjectVector typesFound) { findMemberTypes( typeName, @@ -3434,6 +3450,7 @@ scope, typeInvocation, staticOnly, + staticFieldsAndMethodOnly, false, false, false, @@ -3446,6 +3463,7 @@ Scope scope, SourceTypeBinding typeInvocation, boolean staticOnly, + boolean staticFieldsAndMethodOnly, boolean fromStaticImport, boolean checkQualification, boolean proposeAllMemberTypes, @@ -3469,6 +3487,7 @@ receiverType, typeInvocation, staticOnly, + staticFieldsAndMethodOnly, fromStaticImport, checkQualification, scope); @@ -3504,6 +3523,7 @@ receiverType, typeInvocation, staticOnly, + staticFieldsAndMethodOnly, fromStaticImport, checkQualification, scope); @@ -3521,6 +3541,7 @@ scope, typeInvocation, staticOnly, + staticFieldsAndMethodOnly, fromStaticImport, typesFound); } @@ -3537,6 +3558,7 @@ receiverType, typeInvocation, staticOnly, + staticFieldsAndMethodOnly, fromStaticImport, checkQualification, scope); @@ -3600,6 +3622,7 @@ Scope scope, SourceTypeBinding typeInvocation, boolean staticOnly, + boolean staticFieldsAndMethodOnly, boolean fromStaticImport, ObjectVector typesFound) { @@ -3617,6 +3640,7 @@ receiverType, typeInvocation, staticOnly, + staticFieldsAndMethodOnly, fromStaticImport, true, scope); @@ -3636,6 +3660,7 @@ scope, typeInvocation, staticOnly, + staticFieldsAndMethodOnly, fromStaticImport, typesFound); } @@ -3981,6 +4006,9 @@ relevance += computeRelevanceForStatic(onlyStaticMethods, method.isStatic()); relevance += computeRelevanceForQualification(prefixRequired); relevance += computeRelevanceForRestrictions(IAccessRule.K_ACCESSIBLE); + if (onlyStaticMethods && this.insideQualifiedReference) { + relevance += computeRelevanceForInheritance(receiverType, method.declaringClass); + } this.noProposal = false; // Standard proposal @@ -4247,6 +4275,12 @@ } return 0; } + + private int computeRelevanceForInheritance(ReferenceBinding receiverType, ReferenceBinding declaringClass) { + if (receiverType == declaringClass) return R_NON_INHERITED; + return 0; + } + int computeRelevanceForInterestingProposal(){ return computeRelevanceForInterestingProposal(null); } @@ -4891,7 +4925,7 @@ case Scope.CLASS_SCOPE : SourceTypeBinding enclosingSourceType = scope.enclosingSourceType(); - findMemberTypes(typeName, enclosingSourceType, scope, currentType, false, false, false, proposeAllMemberTypes, nextTypeToIgnore, typesFound); + findMemberTypes(typeName, enclosingSourceType, scope, currentType, false, false, false, false, proposeAllMemberTypes, nextTypeToIgnore, typesFound); nextTypeToIgnore = enclosingSourceType; if (typeLength == 0) return; // do not search outside the class scope if no prefix was provided @@ -5065,6 +5099,7 @@ scope.enclosingSourceType(), false, false, + false, typesFound); } @@ -5219,7 +5254,7 @@ } else { if(!this.requestor.isIgnored(CompletionProposal.KEYWORD)) { if (this.assistNodeInJavadoc == 0 || (this.assistNodeInJavadoc & CompletionOnJavadoc.BASE_TYPES) != 0) { - findKeywords(token, BASE_TYPE_NAMES, false); + findKeywords(token, BASE_TYPE_NAMES, false, false); } } if(proposeType) { @@ -5365,6 +5400,7 @@ scope, scope.enclosingSourceType(), true, + false, true, true, proposeAllMemberTypes,