Bug with simple name lookup inside extends clause?

Liam Miller-Cushon cushon at google.com
Thu Feb 13 15:28:28 PST 2014


The following snippet compiles with javac7, but not javac8-b128.

Shouldn't the type parameter T be shadowing the inner class Test.T?

===
class Test {
  class T<E> {}
  abstract class One<E> {
    abstract E foo();
  }
  abstract class Two<T> extends One<T> {
    abstract T foo();
  }
}
===

error: foo() in Test.Two cannot override foo() in Test.One
    abstract T foo();
               ^
  return type T is not compatible with Test.T
  where T,E are type-variables:
    T extends Object declared in class Test.Two
    E extends Object declared in class Test.One
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20140213/4f3ad8fd/attachment.html 


More information about the compiler-dev mailing list