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

Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java (+10 lines)
Lines 1848-1853 Link Here
1848
										if (foundProblemVisible) {
1848
										if (foundProblemVisible) {
1849
											return foundProblem;
1849
											return foundProblem;
1850
										}
1850
										}
1851
										if (methodBinding.isStatic() && methodBinding.isPrivate()) {
1852
											if (foundProblem != null && foundProblem.problemId() == ProblemReasons.NotVisible) {
1853
												if (((ProblemMethodBinding) foundProblem).closestMatch == methodBinding) {
1854
													MethodBinding[] others = receiverType.getMethods(selector);
1855
													for (int i = 0, l = others.length; i < l; i++)
1856
														if (!others[i].isPrivate() && others[i] != methodBinding) // visible but not a good match
1857
															return foundProblem;
1858
												}
1859
											}
1860
										}
1851
										if (depth > 0) {
1861
										if (depth > 0) {
1852
											invocationSite.setDepth(depth);
1862
											invocationSite.setDepth(depth);
1853
											invocationSite.setActualReceiverType(receiverType);
1863
											invocationSite.setActualReceiverType(receiverType);
(-)src/org/eclipse/jdt/core/tests/compiler/regression/InnerEmulationTest.java (+47 lines)
Lines 6481-6486 Link Here
6481
	IClassFileReader reader = ToolFactory.createDefaultClassFileReader(fileX.getAbsolutePath(), IClassFileReader.CONSTANT_POOL);
6481
	IClassFileReader reader = ToolFactory.createDefaultClassFileReader(fileX.getAbsolutePath(), IClassFileReader.CONSTANT_POOL);
6482
	assertFalse("Should not be final", Flags.isFinal(reader.getAccessFlags()));
6482
	assertFalse("Should not be final", Flags.isFinal(reader.getAccessFlags()));
6483
}
6483
}
6484
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=197271
6485
public void test172() throws Exception {
6486
	this.runNegativeTest(
6487
		new String[] {
6488
			"X.java",//=======================
6489
			"public class X {\n" + 
6490
			"	void a() {}\n" + 
6491
			"	private static void a(String s) {}\n" + 
6492
			"	private void c() {}\n" + 
6493
			"	private static void c(String s) {}\n" + 
6494
			"	static class M1 extends X {\n" + 
6495
			"		public void x() {\n" + 
6496
			"			a(null);\n" + 
6497
			"			c(null);\n" + 
6498
			"		}\n" + 
6499
			"	}\n" + 
6500
			"	static class M2 {\n" + 
6501
			"		public void x() {\n" + 
6502
			"			a(null);\n" + 
6503
			"			c(null);\n" + 
6504
			"		}\n" + 
6505
			"	}\n" + 
6506
			"}\n",
6507
		},
6508
		"----------\n" + 
6509
		"1. WARNING in X.java (at line 4)\n" + 
6510
		"	private void c() {}\n" + 
6511
		"	             ^^^\n" + 
6512
		"The method c() from the type X is never used locally\n" + 
6513
		"----------\n" + 
6514
		"2. ERROR in X.java (at line 8)\n" + 
6515
		"	a(null);\n" + 
6516
		"	^\n" + 
6517
		"The method a(String) from the type X is not visible\n" + 
6518
		"----------\n" + 
6519
		"3. WARNING in X.java (at line 14)\n" + 
6520
		"	a(null);\n" + 
6521
		"	^^^^^^^\n" + 
6522
		"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" + 
6523
		"----------\n" + 
6524
		"4. WARNING in X.java (at line 15)\n" + 
6525
		"	c(null);\n" + 
6526
		"	^^^^^^^\n" + 
6527
		"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" + 
6528
		"----------\n"
6529
	);
6530
}
6484
public static Class testClass() {
6531
public static Class testClass() {
6485
	return InnerEmulationTest.class;
6532
	return InnerEmulationTest.class;
6486
}
6533
}

Return to bug 197271