Evolving the wrapper classes

Brian Goetz brian.goetz at oracle.com
Fri Jun 19 16:04:35 UTC 2020


> Given your examples can we assume that the JVM will never need to do an implicit `Qjava/lang/Integer$val;` to `I` conversion? And these will always be explicit conversions performed by javac?
> 

Correct.

> > - The type [I is considered by the verifier to be equivalent to [java/lang/Integer$val. Array operations (aaload, iaload, etc.) support this.
> 
> Could you please explain the motivation behind this? Specifically, in which cases are iaload and aaload operations both performed on `[I` ? 
> 
> If `I` and `Qjava/lang/Integer$val;` will require explicit javac conversions, shouldn't `[I` and `[java/lang/Integer$val` also?
> 

Because arrays have identity (not to mention potentially large copying costs), there is simply no reasonable conversion we can define; any “conversion” would involve copying all the data, changing identity, or both.  Just as with the array subtyping requirements (Point[] <: Point.ref[] <: Object[]), these are things only the VM can do for us.  


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/valhalla-spec-experts/attachments/20200619/0ce0220e/attachment.htm>


More information about the valhalla-spec-experts mailing list