Casting reference array to any-T array.

Brian Goetz brian.goetz at oracle.com
Wed Jan 7 21:48:26 UTC 2015


> Timely response - I was just writing to confirm that "new T[]" construct
> will be supported.

Tentatively so.  We still have to figure out how to generate the right 
set of warnings, and the right conditions for suppressing those 
warnings, since we don't want to undermine the invariant that "if a 
program compiles with no (suppressed or not) raw or unchecked warnings, 
then the casts inserted by the compiler will not fail."

As an alternative to doing it in the language, we will also consider 
instead providing pre-peeled library methods like:

   <any T> T[] newArray(int)

> As a side note, is the plan to continue erasing T
> for ref types or will the specializer ultimately create a non-erased T
> array for them?

The current functionality continues with the erasure plan.  However, I 
wouldn't mind doing better!


More information about the valhalla-dev mailing list