...
Noncompliant Code Example (increment/decrement)
Prefix and postfix, increment operations and prefix and postfix decrement operations in Java are non-atomic in that the value written depends upon the value initially read from the operand. For example, x++
is non-atomic because it is a composite operation consisting of three discrete operations: reading the current value of x
, adding one to it, and writing the new, incremented value back to x
.
...