JDK-8074570 : Javac does not get membership right when it comes to erased supertypes
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 7-pool,8,9
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2015-03-06
  • Updated: 2016-08-08
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.
Other
tbd_majorUnresolved
Related Reports
Relates :  
Description
This program fails to compile:

interface Sup<X> {
    boolean m(X x);
}

interface Sub<X> extends Sup<String> {
    boolean m(String s);
}

class Test {
    void test() {
        Sub s = new Sub() {
            @Override
            public boolean m(String o) { return true; }
        };
    }

Compiler says:

Main.java:15: error: <anonymous Test$1> is not abstract and does not override abstract method m(Object) in Sup
        Sub s2 = new Sub() {
                           ^
1 error

This seems to be inconsistent with the notion that 'overridden methods should not be inherited'. 

Note: this also affect the functional interface check as of JDK 8.