-
Bug
-
Resolution: Fixed
-
P3
-
9
-
None
-
b120
The implementations of VarHandle.getAndAdd/addAndGet for the byte[]/ByteBuffer views are incorrect if endian conversion is performed. The atomic addition is performed on the encoded augend.
It just so happened that the associated tests use values that do not result in overflow over the byte ranges, hence a bad result was not observed.
If the native endianess does not match that on the VarHandle then the atomic add should be performed in a CAS loop.
It just so happened that the associated tests use values that do not result in overflow over the byte ranges, hence a bad result was not observed.
If the native endianess does not match that on the VarHandle then the atomic add should be performed in a CAS loop.