State of javac support for lworld-values.

Srikanth srikanth.adayapalam at oracle.com
Mon Mar 26 07:27:30 UTC 2018



On Thursday 15 March 2018 11:53 PM, Karen Kinnear wrote:

[...]

>    As with fields, implementation determines if the component is 
> actually flattened.
>>>
>>>   bytecode implications:
>>>      aaload - returns default from default initialized value type 
>>> component
>>>      aastore - throws NPE if attempt to store null. Must store 
>>> default value for component
>>>      anewarray/multianewarray - if the component is a value type, 
>>> create a value type array
> Srikanth - for fields I think you disallow null assignment for value 
> types. I was assuming you would want a similar disallow null 
> assignment to value type array indices.

This is already in place on tip. When it comes to null assignment, javac 
does not distinguish between, fields (flattenable or not), array 
elements, locals, parameters etc. No statically discernible null 
assignment, period. (Or in initialization, or argument substitution for 
parameters)

(And where the RHS of the assignment happens to be an Object or in 
interface type, the language mandates a cast anyway and we have null 
checks inserted at the cast)

Srikanth.


More information about the valhalla-dev mailing list