Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

A reviewer could now recognize that the operation should also be checked for overflow. This might not have been apparent in the original, noncompliant code example. See rule NUM00-J. Detect or prevent integer overflow for more information.

...

This noncompliant code example masks off the upper 24 bits of the promoted byte array element before performing the addition. The number of bits required to mask the sizes of byte and int are specified by the JLS The Java Language Specification. Although this code calculates the correct result, it violates this rule by combining bitwise and arithmetic operations on the same data.

...

Bibliography

...