Bug with simple name lookup inside extends clause?
Michel Trudeau
michel.trudeau at oracle.com
Tue Feb 18 21:02:14 PST 2014
Vicente.
We need a 8-defer-request label and justification.
Michel
Vicente-Arturo Romero-Zaldivar wrote:
> Hi,
>
> I have filed this bug entry:
> https://bugs.openjdk.java.net/browse/JDK-8035259, to track this issue.
>
> Thanks,
> Vicente
>
> On 14/02/14 00:02, Alex Buckley wrote:
>> Regression. The scope of class T's declaration is the body of class
>> Test, including the 'extends' clause of class Two and the body of
>> class Two. However, the type parameter T declared for class Two
>> should shadow class T's declaration throughout the 'extends' clause
>> and body of class Two.
>>
>> Related bug: https://bugs.openjdk.java.net/browse/JDK-7118412.
>>
>> Alex
>>
>> On 2/13/2014 3:28 PM, Liam Miller-Cushon wrote:
>>> 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
>
More information about the compiler-dev
mailing list