[concurrency-interest] Should I avoid compareAndSet with value-based classes?

Doug Lea dl at cs.oswego.edu
Tue Jul 11 13:55:14 EDT 2017

On 07/11/2017 01:48 PM, Aleksey Shipilev wrote:
> Ah, quoting http://cr.openjdk.java.net/~jrose/values/values-0.html:
> "Many of the above restrictions correspond to the restrictions on so-called
> value-based classes. In fact, it seems likely that the boxed form of every value
> type will be a value-based class."
> So this seems to imply that identity-wise:
>   "value type" < "value-based class" < "ordinary class".

Yes, thanks for nicely capturing what Remy and I were trying to get
across last week. My understanding of Gil's suggestions
about treating value-based class as values is that they are only
valid if a compiler does enough global analysis to be sure there
is no possible reliance on identity (including ==).


More information about the Concurrency-interest mailing list