JDK-7141852 : 1.6 v30 no longer compiles particular interface inheritance hierarchy
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 6u29
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: windows_7
  • CPU: x86
  • Submitted: 2012-02-01
  • Updated: 2012-07-04
  • Resolved: 2012-07-04
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6
6u34 b01Fixed
Description
FULL PRODUCT VERSION :
java version "1.6.0_30"
Java(TM) SE Runtime Environment (build 1.6.0_30-b12)
Java HotSpot(TM) Client VM (build 20.5-b03, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7600]

A DESCRIPTION OF THE PROBLEM :
I have a java interface hierarchy that compiled prior to 1.6v30, and it no longer compiles.

REGRESSION.  Last worked in version 6u29

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
I have a small set of interfaces to reproduce the problem

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
  To compile successfully
ACTUAL -
reference to getObject is ambiguous, both method getObject() in test.jcb.TestInterface3b and method getObject() in test.jcb.TestInterface3b match

ERROR MESSAGES/STACK TRACES THAT OCCUR :
reference to getObject is ambiguous, both method getObject() in test.jcb.TestInterface3b and method getObject() in test.jcb.TestInterface3b match

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
I have source, but it is several interfaces.  Not sure how to attach it:

public interface RetInterface1{}
public interface RetInterface2 extends RetInterface1 {}
public interface TestInterface extends TestInterface1a, TestInterface2a, TestInterface3a{}
public interface TestInterface1a extends TestInterface1b{}
public interface TestInterface1b extends TestInterface1c
{
    RetInterface2 getObject();
}
public interface TestInterface1c
{
    RetInterface1 getObject();
}
public interface TestInterface2a extends TestInterface1b, TestInterface2b, TestInterface3b{}
public interface TestInterface2b extends TestInterface3c   // if you comment out this extends, it compiles fine
{
}
public interface TestInterface3a extends TestInterface3b{}
public interface TestInterface3b extends TestInterface3c
{
    RetInterface2 getObject();
}
public interface TestInterface3c
{
    RetInterface1 getObject();
}
public class TestClass
{
    public static void main(String[] args)
    {
        TestInterface testIntf = new TestInterface()
        {
            public RetInterface2 getObject()
            {
                return null;
            }
        };

        testIntf.getObject();
    }
}
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
No work around

Comments
EVALUATION Resolve.MostSpecific erroneously depends on the order in which applicable methods are visited.
11-05-2012

EVALUATION It's a consequence of porting 7024568 w/o porting other changes it relies on. Need to port 6487370 as well or revert back 7024568 (preferably).
15-03-2012