RFR: 8357913: Add `@Stable` to BigInteger and BigDecimal [v3]

Per Minborg pminborg at openjdk.org
Mon Jun 2 18:25:53 UTC 2025


On Fri, 30 May 2025 22:07:06 GMT, Shaojin Wen <swen at openjdk.org> wrote:

>> Some static final arrays of BigInteger and BigDecimal are stable and immutable. We should add `@Stable` to give the optimizer more information
>
> Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision:
> 
>   BigInteger::mag remove Stable

A general comment with respect to `@Stable` is that it asserts the field/elements will only change at most once (e.g., an array cannot expand, an element can't be written to more than once (unless the contents is "equivalent")). It is dangerous not to uphold the invariants imposed by `@Stable`. So, triple-checking for potential updates (even via reflection) must be done.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/25437#issuecomment-2931938182


More information about the core-libs-dev mailing list