Joe,
While I note that the primary text has been modified to include long
types, the italic comment that follows still ends with the following:
Notice that integer literals of type|long|are allowed, but not required,
to be shared.
-- Jon
On 4/25/18 8:18 AM, joe darcy wrote:
Hi David,
On 4/25/2018 5:08 AM, David Holmes wrote:
Hi Joe,
On 25/04/2018 10:30 AM, joe darcy wrote:
Hello,
Please review the patch below to update the specification of
Long.valueOf(long) to require caching on [-128, 127]. The JDK
implementation of this functionality has always cached in that
region, even though it is not required.
Seems very explicit that there is no requirement for Long to do
caching. So why should that change? Or put another way what has
changed that invalidates that clearly stated position?
JLS 9 changed the requirements on autobox caching going from Java SE 8
to 9:
https://docs.oracle.com/javase/specs/jls/se8/html/jls-5.html#jls-5.1.7
vs
https://docs.oracle.com/javase/specs/jls/se9/html/jls-5.html#jls-5.1.7
The Long.valueOf method is used to implement autoboxing and its
caching spec wasn't updated accordingly at the time.
Cheers,
-Joe