[lworld] RFR: 8369921: [lworld] Remove caches of primitive wrapper classes
Chen Liang
liach at openjdk.org
Mon Oct 20 15:16:35 UTC 2025
On Fri, 17 Oct 2025 19:28:37 GMT, Roger Riggs <rriggs at openjdk.org> wrote:
> Disable use of wrapper cached values when --enable-preview and add javadoc descriptions for enable-preview.
> The wrapper classes are Byte, Short, Character, Integer, and Long.
Double and Float already do new, so they are fine. Should we update Boolean.valueOf to return `new Boolean` instead of TRUE or FALSE?
src/java.base/share/classes/java/lang/Long.java line 1020:
> 1018: @DeserializeConstructor
> 1019: public static Long valueOf(long l) {
> 1020: final int offset = 128;
I recommend moving this into the preview feature block too.
src/java.base/share/classes/java/lang/Short.java line 301:
> 299: public static Short valueOf(short s) {
> 300: final int offset = 128;
> 301: int sAsInt = s;
Same remark, I recommend moving this into the preview feature check block.
-------------
PR Comment: https://git.openjdk.org/valhalla/pull/1685#issuecomment-3422526752
PR Review Comment: https://git.openjdk.org/valhalla/pull/1685#discussion_r2445312384
PR Review Comment: https://git.openjdk.org/valhalla/pull/1685#discussion_r2445313050
More information about the valhalla-dev
mailing list