diff --git a/src/java.base/share/classes/java/lang/Byte.java b/src/java.base/share/classes/java/lang/Byte.java index 74a42d98a43..18502abf69c 100644 --- a/src/java.base/share/classes/java/lang/Byte.java +++ b/src/java.base/share/classes/java/lang/Byte.java @@ -27,6 +27,7 @@ package java.lang; import jdk.internal.misc.CDS; import jdk.internal.vm.annotation.IntrinsicCandidate; +import jdk.internal.vm.annotation.Stable; import java.lang.constant.Constable; import java.lang.constant.DynamicConstantDesc; @@ -105,9 +106,10 @@ public final class Byte extends Number implements Comparable, Constable { return Optional.of(DynamicConstantDesc.ofNamed(BSM_EXPLICIT_CAST, DEFAULT_NAME, CD_byte, intValue())); } - private static class ByteCache { + private static final class ByteCache { private ByteCache() {} + @Stable static final Byte[] cache; static Byte[] archivedCache; diff --git a/src/java.base/share/classes/java/lang/Character.java b/src/java.base/share/classes/java/lang/Character.java index 81548aae73d..d4399d2af6a 100644 --- a/src/java.base/share/classes/java/lang/Character.java +++ b/src/java.base/share/classes/java/lang/Character.java @@ -27,6 +27,7 @@ package java.lang; import jdk.internal.misc.CDS; import jdk.internal.vm.annotation.IntrinsicCandidate; +import jdk.internal.vm.annotation.Stable; import java.lang.constant.Constable; import java.lang.constant.DynamicConstantDesc; @@ -8956,9 +8957,10 @@ class Character implements java.io.Serializable, Comparable, Constabl this.value = value; } - private static class CharacterCache { + private static final class CharacterCache { private CharacterCache(){} + @Stable static final Character[] cache; static Character[] archivedCache; diff --git a/src/java.base/share/classes/java/lang/Integer.java b/src/java.base/share/classes/java/lang/Integer.java index 1e136cdde0c..8c8bcb9226f 100644 --- a/src/java.base/share/classes/java/lang/Integer.java +++ b/src/java.base/share/classes/java/lang/Integer.java @@ -29,6 +29,7 @@ import jdk.internal.misc.CDS; import jdk.internal.misc.VM; import jdk.internal.vm.annotation.ForceInline; import jdk.internal.vm.annotation.IntrinsicCandidate; +import jdk.internal.vm.annotation.Stable; import java.lang.annotation.Native; import java.lang.constant.Constable; @@ -1005,9 +1006,11 @@ public final class Integer extends Number * with new Integer object(s) after initialization. */ - private static class IntegerCache { + private static final class IntegerCache { static final int low = -128; static final int high; + + @Stable static final Integer[] cache; static Integer[] archivedCache; diff --git a/src/java.base/share/classes/java/lang/Long.java b/src/java.base/share/classes/java/lang/Long.java index 6db8f8a96c1..fb5e4cecca8 100644 --- a/src/java.base/share/classes/java/lang/Long.java +++ b/src/java.base/share/classes/java/lang/Long.java @@ -36,6 +36,7 @@ import java.util.Optional; import jdk.internal.misc.CDS; import jdk.internal.vm.annotation.ForceInline; import jdk.internal.vm.annotation.IntrinsicCandidate; +import jdk.internal.vm.annotation.Stable; import static java.lang.String.COMPACT_STRINGS; import static java.lang.String.LATIN1; @@ -1156,9 +1157,10 @@ public final class Long extends Number return Long.valueOf(parseLong(s, 10)); } - private static class LongCache { + private static final class LongCache { private LongCache() {} + @Stable static final Long[] cache; static Long[] archivedCache; diff --git a/src/java.base/share/classes/java/lang/Short.java b/src/java.base/share/classes/java/lang/Short.java index fa93dcbccab..6a148d1edac 100644 --- a/src/java.base/share/classes/java/lang/Short.java +++ b/src/java.base/share/classes/java/lang/Short.java @@ -27,6 +27,7 @@ package java.lang; import jdk.internal.misc.CDS; import jdk.internal.vm.annotation.IntrinsicCandidate; +import jdk.internal.vm.annotation.Stable; import java.lang.constant.Constable; import java.lang.constant.DynamicConstantDesc; @@ -231,9 +232,10 @@ public final class Short extends Number implements Comparable, Constable return Optional.of(DynamicConstantDesc.ofNamed(BSM_EXPLICIT_CAST, DEFAULT_NAME, CD_short, intValue())); } - private static class ShortCache { + private static final class ShortCache { private ShortCache() {} + @Stable static final Short[] cache; static Short[] archivedCache;