Bug 279182

Summary: [1.5][compiler] Anon types can't reference outer covariant methods with the <Outer class name>.this.<method> idiom
Product: [Eclipse Project] JDT Reporter: Hollis Waite <hwaite>
Component: CoreAssignee: Kent Johnson <kent_johnson>
Status: VERIFIED NOT_ECLIPSE QA Contact:
Severity: normal    
Priority: P3 CC: Olivier_Thomann
Version: 3.5   
Target Milestone: 3.5 RC4   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Hollis Waite CLA 2009-06-04 19:38:32 EDT
Build ID: I20090522-1710

Steps To Reproduce:
public abstract class AbstractTest {public abstract Object m();}
--
public interface InterfaceTest {Integer m();}
--
public abstract class AbstractSubTest extends AbstractTest implements InterfaceTest {
  Object mO = new Object() {void m2() {AbstractSubTest.this.m();}};
}


More information:
Won't compile in JDK 1.6.0_14-b08: AbstractSubTest.java:4: reference to m is ambiguous, both method m() in AbstractTest and method m() in InterfaceTest match
  Object mO = new Object() {void m2() {AbstractSubTest.this.m();}};

As is often the case, Eclipse's behavior seems preferable.  Maybe it's really a Java bug.
Comment 1 Kent Johnson CLA 2009-06-05 12:07:58 EDT
> Won't compile in JDK 1.6.0_14-b08

but it does compile with the version 7 beta (May 14th)

I believe this is a javac bug that is fixed in the version 7 stream
Comment 2 Olivier Thomann CLA 2009-06-05 15:20:05 EDT
Verified for 3.5RC4.