Fwd: Migrating the primitive boxes to values
brian.goetz at oracle.com
Mon Sep 30 20:12:14 UTC 2019
Received on the -comments list (some time ago).
-------- Forwarded Message --------
Subject: Migrating the primitive boxes to values
Date: Sat, 26 Jan 2019 00:07:53 -0800
From: Jack Ammo <jackammo77 at gmail.com>
To: valhalla-spec-comments at openjdk.java.net
From an outsider's perspective, i'd like to ask a perhaps naive question
about the locking issue on values. Instead of just opting to break existing
code as you seem to be worried about, why not just box the value before
locking? Assuming that a boxing conversion to a full fledged Object is
still kicking around as a fall back, this seems like the most familiar
option to me as a developer: i can technically do the lock on an Integer
but it is not advised and results are not guaranteed. I understand that
everyone has worked hard to avoid the cost of boxing, but in this
particular case it seems like a decent option that is the least difficult
to wrap my mind around. Locking requires a full Object, so values (like an
int) need to be boxed as such.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the valhalla-spec-experts