### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java,v retrieving revision 1.97 diff -u -r1.97 CompilationUnitScope.java --- compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java 6 Feb 2006 21:14:39 -0000 1.97 +++ compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java 13 Feb 2006 15:00:07 -0000 @@ -496,7 +496,7 @@ // look to see if its a static field first ReferenceBinding type = (ReferenceBinding) binding; FieldBinding field = findField(type, name, null, true); - if (field != null && field.isValidBinding() && field.isStatic() && field.canBeSeenBy(fPackage)) + if (field != null && field.isValidBinding() && field.isStatic() && field.canBeSeenBy(type, null, this)) return field; // look to see if there is a static method with the same selector Index: compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java,v retrieving revision 1.258 diff -u -r1.258 Scope.java --- compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 11 Feb 2006 16:27:15 -0000 1.258 +++ compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 13 Feb 2006 15:00:11 -0000 @@ -1653,15 +1653,15 @@ if (importBinding.isStatic() && !importBinding.onDemand) { if (CharOperation.equals(importBinding.compoundName[importBinding.compoundName.length - 1], name)) { if (unitScope.resolveSingleImport(importBinding) != null && importBinding.resolvedImport instanceof FieldBinding) { - ReferenceBinding declaringClass = ((FieldBinding) importBinding.resolvedImport).declaringClass; - if (declaringClass.canBeSeenBy(this)) { - ImportReference importReference = importBinding.reference; - if (importReference != null) importReference.used = true; - invocationSite.setActualReceiverType(declaringClass); - return importBinding.resolvedImport; + foundField = (FieldBinding) importBinding.resolvedImport; + ImportReference importReference = importBinding.reference; + if (importReference != null) importReference.used = true; + invocationSite.setActualReceiverType(foundField.declaringClass); + if (foundField.isValidBinding()) { + return foundField; } if (problemField == null) - problemField = new ProblemFieldBinding(declaringClass, name, ProblemReasons.ReceiverTypeNotVisible); + problemField = foundField; } } } #P org.eclipse.jdt.core.tests.compiler Index: src/org/eclipse/jdt/core/tests/compiler/regression/StaticImportTest.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/StaticImportTest.java,v retrieving revision 1.43 diff -u -r1.43 StaticImportTest.java --- src/org/eclipse/jdt/core/tests/compiler/regression/StaticImportTest.java 13 Feb 2006 12:18:35 -0000 1.43 +++ src/org/eclipse/jdt/core/tests/compiler/regression/StaticImportTest.java 13 Feb 2006 15:00:13 -0000 @@ -129,24 +129,20 @@ }, "" ); - this.runNegativeTest( + this.runConformTest( new String[] { "X.java", "import static p.A.C;\n" + - "public class X { int i = C; }\n", + "public class X { \n" + + " int i = C; \n" + + " int j = p.A.C; \n" + + "}\n", "p/A.java", "package p;\n" + "public class A implements I {}\n" + "interface I { public static int C = 1; }\n" }, - "----------\n" + - "1. ERROR in X.java (at line 2)\n" + - " public class X { int i = C; }\n" + - " ^\n" + - "The type I is not visible\n" + - "----------\n" - // C in p.I is not defined in a public class or interface; cannot be accessed from outside package - ); + ""); } public void test004() { // test static vs. instance @@ -1341,7 +1337,7 @@ ); } //https://bugs.eclipse.org/bugs/show_bug.cgi?id=126564 - public void _test036() { + public void test036() { this.runNegativeTest( new String[] { "X.java", @@ -1360,41 +1356,25 @@ "class B { int CONSTANT_B = 1; }", }, "----------\n" + - "1. ERROR in X.java (at line 1)\n" + - " import static p.A.CONSTANT_I;\n" + - " ^^^^^^^^^^^^^^\n" + - "The type I is not visible\n" + - "----------\n" + - "2. ERROR in X.java (at line 2)\n" + + "1. ERROR in X.java (at line 2)\n" + " import static p.A.CONSTANT_B;\n" + " ^^^^^^^^^^^^^^\n" + "The type B is not visible\n" + "----------\n" + - "3. ERROR in X.java (at line 4)\n" + - " static int i = p.A.CONSTANT_I;\n" + - " ^^^^^^^^^^^^^^\n" + - "The type I is not visible\n" + - "----------\n" + - "4. ERROR in X.java (at line 5)\n" + + "2. ERROR in X.java (at line 5)\n" + " static int j = p.A.CONSTANT_B;\n" + " ^^^^^^^^^^^^^^\n" + "The type B is not visible\n" + "----------\n" + - "5. ERROR in X.java (at line 6)\n" + - " static int m = CONSTANT_I;\n" + - " ^^^^^^^^^^\n" + - "CONSTANT_I cannot be resolved\n" + - "----------\n" + - "6. ERROR in X.java (at line 7)\n" + + "3. ERROR in X.java (at line 7)\n" + " static int n = CONSTANT_B;\n" + " ^^^^^^^^^^\n" + "CONSTANT_B cannot be resolved\n" + - "----------\n" - ); + "----------\n"); } //https://bugs.eclipse.org/bugs/show_bug.cgi?id=126564 - variation - public void _test037() { - this.runNegativeTest( + public void test037() { + this.runConformTest( new String[] { "X.java", "import static p.A.CONSTANT_I;\n" + @@ -1411,6 +1391,6 @@ "interface I { int CONSTANT_I = 1; }\n" + "class B { public static int CONSTANT_B = 1; }", }, - "?"); + ""); } }