diff --git a/src/java.base/share/classes/java/math/BigDecimal.java b/src/java.base/share/classes/java/math/BigDecimal.java index 534f840174c..3b7d9e0d65b 100644 --- a/src/java.base/share/classes/java/math/BigDecimal.java +++ b/src/java.base/share/classes/java/math/BigDecimal.java @@ -44,6 +44,7 @@ import jdk.internal.access.JavaLangAccess; import jdk.internal.access.SharedSecrets; import jdk.internal.math.FormattedFPDecimal; import jdk.internal.util.DecimalDigits; +import jdk.internal.vm.annotation.Stable; /** * Immutable, arbitrary-precision signed decimal numbers. A {@code @@ -409,6 +410,7 @@ public class BigDecimal extends Number implements Comparable { private static final long serialVersionUID = 6108874887143696463L; // Cache of common small BigDecimal values. + @Stable private static final BigDecimal[] ZERO_THROUGH_TEN = { new BigDecimal(BigInteger.ZERO, 0, 0, 1), new BigDecimal(BigInteger.ONE, 1, 0, 1), @@ -424,6 +426,7 @@ public class BigDecimal extends Number implements Comparable { }; // Cache of zero scaled by 0 - 15 + @Stable private static final BigDecimal[] ZERO_SCALED_BY = { ZERO_THROUGH_TEN[0], new BigDecimal(BigInteger.ZERO, 0, 1, 1), @@ -4084,6 +4087,7 @@ public class BigDecimal extends Number implements Comparable { * Powers of 10 which can be represented exactly in {@code * double}. */ + @Stable private static final double[] DOUBLE_10_POW = { 1.0e0, 1.0e1, 1.0e2, 1.0e3, 1.0e4, 1.0e5, 1.0e6, 1.0e7, 1.0e8, 1.0e9, 1.0e10, 1.0e11, @@ -4095,6 +4099,7 @@ public class BigDecimal extends Number implements Comparable { * Powers of 10 which can be represented exactly in {@code * float}. */ + @Stable private static final float[] FLOAT_10_POW = { 1.0e0f, 1.0e1f, 1.0e2f, 1.0e3f, 1.0e4f, 1.0e5f, 1.0e6f, 1.0e7f, 1.0e8f, 1.0e9f, 1.0e10f @@ -4291,6 +4296,7 @@ public class BigDecimal extends Number implements Comparable { } } + @Stable private static final long[] LONG_TEN_POWERS_TABLE = { 1, // 0 / 10^0 10, // 1 / 10^1 @@ -4340,6 +4346,7 @@ public class BigDecimal extends Number implements Comparable { private static final int BIG_TEN_POWERS_TABLE_MAX = 16 * BIG_TEN_POWERS_TABLE_INITLEN; + @Stable private static final long[] THRESHOLDS_TABLE = { Long.MAX_VALUE, // 0 Long.MAX_VALUE/10L, // 1 @@ -5091,6 +5098,7 @@ public class BigDecimal extends Number implements Comparable { /** * {@code FIVE_TO_2_TO[n] == 5^(2^n)} */ + @Stable private static final BigInteger[] FIVE_TO_2_TO = new BigInteger[16 + 1]; static { @@ -5889,6 +5897,7 @@ public class BigDecimal extends Number implements Comparable { return null; } + @Stable private static final long[][] LONGLONG_TEN_POWERS_TABLE = { { 0L, 0x8AC7230489E80000L }, //10^19 { 0x5L, 0x6bc75e2d63100000L }, //10^20 diff --git a/src/java.base/share/classes/java/math/BigInteger.java b/src/java.base/share/classes/java/math/BigInteger.java index a6ce483f3eb..51d935f10c1 100644 --- a/src/java.base/share/classes/java/math/BigInteger.java +++ b/src/java.base/share/classes/java/math/BigInteger.java @@ -1303,6 +1303,7 @@ public class BigInteger extends Number implements Comparable { private static volatile BigInteger[][] powerCache; /** The cache of logarithms of radices for base conversion. */ + @Stable private static final double[] logCache; /** The natural log of 2. This is used in computing cache indices. */