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

Andrew Haley aph at redhat.com
Sat Jul 8 04:19:08 EDT 2017

On 08/07/17 07:38, Gil Tene wrote:

> My arguments here are not about trying to justify some compiler
> optimizations, or trying to justify the choices of making these
> things subclasses the Object. They are about pointing out the actual
> meaning of things as defined and the (very high risk) of coding
> against it based on a hope that some temporarily observed behavior
> is actually reliable, when everything that describes what it does
> says otherwise.

I disagree with this interpretation.  You're interpreting the language
in that paragraph as overriding some fundamental properties in the JLS.

In the case of C, the thing to do would be to ask for a clarification,
but I suspect that if we asked, say, John Rose, Alex Buckley, and
Brian Goetz we'd get different answers.  ;-)

Andrew Haley
Java Platform Lead Engineer
Red Hat UK Ltd. <https://www.redhat.com>
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671

More information about the Concurrency-interest mailing list