View | Details | Raw Unified | Return to bug 197271 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/compiler/regression/InnerEmulationTest.java (+47 lines)
Lines 7012-7017 Link Here
7012
	},
7012
	},
7013
	"SUCCESS");
7013
	"SUCCESS");
7014
}
7014
}
7015
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=197271
7016
public void test172() throws Exception {
7017
	this.runNegativeTest(
7018
		new String[] {
7019
			"X.java",//=======================
7020
			"public class X {\n" + 
7021
			"	void a() {}\n" + 
7022
			"	private static void a(String s) {}\n" + 
7023
			"	private void c() {}\n" + 
7024
			"	private static void c(String s) {}\n" + 
7025
			"	static class M1 extends X {\n" + 
7026
			"		public void x() {\n" + 
7027
			"			a(null);\n" + 
7028
			"			c(null);\n" + 
7029
			"		}\n" + 
7030
			"	}\n" + 
7031
			"	static class M2 {\n" + 
7032
			"		public void x() {\n" + 
7033
			"			a(null);\n" + 
7034
			"			c(null);\n" + 
7035
			"		}\n" + 
7036
			"	}\n" + 
7037
			"}\n",
7038
		},
7039
		"----------\n" + 
7040
		"1. WARNING in X.java (at line 4)\n" + 
7041
		"	private void c() {}\n" + 
7042
		"	             ^^^\n" + 
7043
		"The method c() from the type X is never used locally\n" + 
7044
		"----------\n" + 
7045
		"2. ERROR in X.java (at line 8)\n" + 
7046
		"	a(null);\n" + 
7047
		"	^\n" + 
7048
		"The method a(String) from the type X is not visible\n" + 
7049
		"----------\n" + 
7050
		"3. WARNING in X.java (at line 14)\n" + 
7051
		"	a(null);\n" + 
7052
		"	^^^^^^^\n" + 
7053
		"Access to enclosing method a(String) from the type X is emulated by a synthetic accessor method\n" + 
7054
		"----------\n" + 
7055
		"4. WARNING in X.java (at line 15)\n" + 
7056
		"	c(null);\n" + 
7057
		"	^^^^^^^\n" + 
7058
		"Access to enclosing method c(String) from the type X is emulated by a synthetic accessor method\n" + 
7059
		"----------\n"
7060
	);
7061
}
7015
public static Class testClass() {
7062
public static Class testClass() {
7016
	return InnerEmulationTest.class;
7063
	return InnerEmulationTest.class;
7017
}
7064
}
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java (+10 lines)
Lines 1842-1847 Link Here
1842
										if (foundProblemVisible) {
1842
										if (foundProblemVisible) {
1843
											return foundProblem;
1843
											return foundProblem;
1844
										}
1844
										}
1845
										if (methodBinding.isStatic() && methodBinding.isPrivate()) {
1846
											if (foundProblem != null && foundProblem.problemId() == ProblemReasons.NotVisible) {
1847
												if (((ProblemMethodBinding) foundProblem).closestMatch == methodBinding) {
1848
													MethodBinding[] others = receiverType.getMethods(selector);
1849
													for (int i = 0, l = others.length; i < l; i++)
1850
														if (!others[i].isPrivate() && others[i] != methodBinding) // visible but not a good match
1851
															return foundProblem;
1852
												}
1853
											}
1854
										}
1845
										if (depth > 0) {
1855
										if (depth > 0) {
1846
											invocationSite.setDepth(depth);
1856
											invocationSite.setDepth(depth);
1847
											invocationSite.setActualReceiverType(receiverType);
1857
											invocationSite.setActualReceiverType(receiverType);

Return to bug 197271