Regression in the javac 1.8u40

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Mon Apr 20 16:13:03 UTC 2015


Hi Aaron,
the following program seems to compile for me - what am I missing?


interface Bar<B extends Bar<B>> {
    <T extends Bar<T>> T foo();
}

class A implements Bar<A> {
    @Override
    public <T extends Bar<T>> T foo() {
       return null;
    }
}

class B extends A {
    @Override
    public <T extends Bar<T>> T foo() {
       T result = super.foo();
       return result;
    }
}


Maurizio

On 20/04/15 17:03, Rob McKenna wrote:
> <T extends Bar<T>> T foo();
>
> where Bar is
>
>      interface Bar<B extends Bar<B>> {}
>
> I can implement this method without problem
>          @Override
>      public <T extends Bar<T>> T foo() {
>         return null;
>      }
>
> but I can't override such a method anymore in Java 8:
>
>      @Override
>      public <T extends Bar<T>> T foo() {
>         T result = super.foo();
>         return result;
>      } 



More information about the compiler-dev mailing list