Duplicate :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
5060485 made an attempt at fixing an issue with shadowing of type-variables w.r.t. member type declarations. Unfortunately the fix is incomplete - the following code works: public class X<Y> { static public class Y {} static public class Y1 <T extends X<Y>> { } } Showing that, in the declaration of Y1, Y is correctly resolved to the nested class, not the type-parameter. However there are cases in which javac still gets shadowing wrong: class Test<T> { static class T { } static T q; } This fails with the following message: TestBug.java:13: non-static class T cannot be referenced from a static context static T q; ^ 1 error Revealing that javac is resolving T to the type-variable type rather than to the class type.
|