__WhereVal/__WhereRef on fields

Brian Goetz brian.goetz at oracle.com
Wed Dec 16 17:43:06 UTC 2015


It definitely does not currently do so.

Not clear whether this will be part of the eventual model or not -- 
still figuring out the pros and cons of this.

On 12/16/2015 12:37 PM, Ali Ebrahimi wrote:
> Hi,
> Is compiler supposed to handle restrictions on fields?
>
> public class Main {
>
>      public static class Test<any T>{
>          public __WhereVal(T) int x;
>          public __WhereRef(T) long x2;
>      }
>      public static void main(String[] args) {
>          Test<int> ti = new Test<int>();
>          long p = ti.x2; //<=======================
>      }
> }
>
>



More information about the valhalla-dev mailing list