Model 3 Classfile Enhancements question

Brian Goetz brian.goetz at oracle.com
Mon Feb 29 00:11:55 UTC 2016


Assuming Optional<any T> is a value type, it corresponds to:

    ParamType[LList, ParamType[QOptional, erased]]

Reference types as type arguments are always erased, whether they are arguments to a reference or value type.  So the above corresponds to “reified List of erased Optional.”  

The construction is compositional.  We construct the description of the inner type (ParamType[QOptional, erased]), and then we either reify that or erase it depending on whether the result is reference or value. 

On Feb 28, 2016, at 7:04 PM, Stephen Colebourne <scolebourne at joda.org> wrote:

> The document and following discussion is interesting, however I still
> have a question:
> 
> This type
> List<Optional<int>>
> maps to
> ParameterizedType['L', "List", ParameterizedType['Q', "Optional", "I"]]
> 
> but what does this type map to?
> 
> List<Optional<String>>
> 
> In other words, is the "String" erased or reified. (If Optional was a
> reference type, then it is obviously erased, but since Optional is a
> value type in the document, the answer is not clear).
> 
> Stephen



More information about the valhalla-dev mailing list