### Eclipse Workspace Patch 1.0 #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.333.2.5 diff -u -r1.333.2.5 Scope.java --- compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 4 Nov 2008 17:04:17 -0000 1.333.2.5 +++ compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 4 Dec 2008 16:42:18 -0000 @@ -1848,6 +1848,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); #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.36.2.2 diff -u -r1.36.2.2 InnerEmulationTest.java --- src/org/eclipse/jdt/core/tests/compiler/regression/InnerEmulationTest.java 10 Jul 2008 18:15:27 -0000 1.36.2.2 +++ src/org/eclipse/jdt/core/tests/compiler/regression/InnerEmulationTest.java 4 Dec 2008 16:42:19 -0000 @@ -6481,6 +6481,53 @@ IClassFileReader reader = ToolFactory.createDefaultClassFileReader(fileX.getAbsolutePath(), IClassFileReader.CONSTANT_POOL); assertFalse("Should not be final", Flags.isFinal(reader.getAccessFlags())); } +//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. Increasing its visibility will improve your performance\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. Increasing its visibility will improve your performance\n" + + "----------\n" + ); +} public static Class testClass() { return InnerEmulationTest.class; }