Accessing static members on type variables

Raffaele Sgarro raffaelesgarro at gmail.com
Fri Apr 4 08:06:47 UTC 2014


Still, it compiles and runs successfully, so there must be some piece of
code in the compiler that replaces the type variable with its bound, and
that piece of code must be intentional.

I didn't test with JDK8 (or any compiler other than 1.7)


2014-04-04 9:59 GMT+02:00 Remi Forax <forax at univ-mlv.fr>:

> On 04/04/2014 09:54 AM, Raffaele Sgarro wrote:
>
>> Consider the following code (ideone <http://ideone.com/GtBQEy>):
>>
>>
>> class  Outer{
>>    public  static  final  String  FIELD=  "Success!";
>> }
>>
>> class  Test<Textends  Outer>{
>>
>>    public  String  test()  {
>>      return  T.FIELD;
>>    }  }
>> Does the JSL allow a type variable T to be used to access static members
>> of its upper bound?
>>
>
> No !
>
> Rémi
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20140404/aa3e345c/attachment.html>


More information about the compiler-dev mailing list