Versions Compared

Key

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

...

If the value p being boxed is true, false, a byte, a char in the range \u0000 to \u007f, or an int or short number between -128 and 127, then let r1 and r2 be the results of any two boxing conversions of p. It is always the case that r1 == r2.

Also:

This ensures that in most common cases, the behavior will be the desired one, without imposing an undue performance penalty, especially on small devices. Less memory-limited implementations might, for example, cache all characters and shorts, as well as integers and longs in the range of -32K - +32K.

So the interval of memoization is not precisely specified by the JLS, and can depend on the implementation.

Noncompliant Code Example

...