### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core.tests.compiler Index: src/org/eclipse/jdt/core/tests/compiler/regression/InnerEmulationTest.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/InnerEmulationTest.java,v retrieving revision 1.48 diff -u -r1.48 InnerEmulationTest.java --- src/org/eclipse/jdt/core/tests/compiler/regression/InnerEmulationTest.java 24 Nov 2008 13:14:05 -0000 1.48 +++ src/org/eclipse/jdt/core/tests/compiler/regression/InnerEmulationTest.java 3 Dec 2008 20:08:04 -0000 @@ -7012,6 +7012,53 @@ }, "SUCCESS"); } +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=197271 +public void test172() throws Exception { + this.runNegativeTest( + new String[] { + "X.java",//======================= + "public class X {\n" + + " void a() {}\n" + + " private static void a(String s) {}\n" + + " private void c() {}\n" + + " private static void c(String s) {}\n" + + " static class M1 extends X {\n" + + " public void x() {\n" + + " a(null);\n" + + " c(null);\n" + + " }\n" + + " }\n" + + " static class M2 {\n" + + " public void x() {\n" + + " a(null);\n" + + " c(null);\n" + + " }\n" + + " }\n" + + "}\n", + }, + "----------\n" + + "1. WARNING in X.java (at line 4)\n" + + " private void c() {}\n" + + " ^^^\n" + + "The method c() from the type X is never used locally\n" + + "----------\n" + + "2. ERROR in X.java (at line 8)\n" + + " a(null);\n" + + " ^\n" + + "The method a(String) from the type X is not visible\n" + + "----------\n" + + "3. WARNING in X.java (at line 14)\n" + + " a(null);\n" + + " ^^^^^^^\n" + + "Access to enclosing method a(String) from the type X is emulated by a synthetic accessor method\n" + + "----------\n" + + "4. WARNING in X.java (at line 15)\n" + + " c(null);\n" + + " ^^^^^^^\n" + + "Access to enclosing method c(String) from the type X is emulated by a synthetic accessor method\n" + + "----------\n" + ); +} public static Class testClass() { return InnerEmulationTest.class; } #P org.eclipse.jdt.core 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.345 diff -u -r1.345 Scope.java --- compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 10 Nov 2008 11:53:39 -0000 1.345 +++ compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 3 Dec 2008 20:08:07 -0000 @@ -1842,6 +1842,16 @@ if (foundProblemVisible) { return foundProblem; } + if (methodBinding.isStatic() && methodBinding.isPrivate()) { + if (foundProblem != null && foundProblem.problemId() == ProblemReasons.NotVisible) { + if (((ProblemMethodBinding) foundProblem).closestMatch == methodBinding) { + MethodBinding[] others = receiverType.getMethods(selector); + for (int i = 0, l = others.length; i < l; i++) + if (!others[i].isPrivate() && others[i] != methodBinding) // visible but not a good match + return foundProblem; + } + } + } if (depth > 0) { invocationSite.setDepth(depth); invocationSite.setActualReceiverType(receiverType);