RFR: 8357063: Document preconditions for DecimalDigits methods

Volkan Yazici vyazici at openjdk.org
Fri May 16 08:01:22 UTC 2025


On Thu, 15 May 2025 06:24:44 GMT, Shaojin Wen <swen at openjdk.org> wrote:

> Similar to PR #24982 
> Document preconditions on certain DecimalDigits methods that use operations either unsafe and/or without range checks.

src/java.base/share/classes/jdk/internal/util/DecimalDigits.java line 297:

> 295:      */
> 296:     public static int uncheckedGetCharsUTF16(long i, int index, byte[] buf) {
> 297:         // Used by trusted callers.  Assumes all necessary bounds checks have been done by the caller.

Regarding all methods that are prefixed with `unsynchronized` in this PR, IMHO:

1. Precondition warnings should better be moved to the JavaDoc (ala #24982)
2. We shall also consider implementing these preconditions using `assert` statements

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25246#discussion_r2092539634


More information about the core-libs-dev mailing list