On Sun, 20 Oct 2024 17:33:09 GMT, j3graham <d...@openjdk.org> wrote: >> Move getChars methods of StringLatin1 and StringUTF16 to DecimalDigits to >> reduce duplication >> >> 1. HexDigits and OctalDigits also include getCharsLatin1 and getCharsUTF16 >> 2. Putting these two methods into DecimalDigits can avoid the need to expose >> them in JavaLangAccess >> 3. Eliminate duplicate code in BigDecimal > > src/java.base/share/classes/java/math/BigDecimal.java line 4216: > >> 4214: // Get the significand as an absolute value >> 4215: if (intCompact != INFLATED) { >> 4216: coeff = new char[19]; > > A possibility here would be to change `coeff` to be a String. The “else” > branch already creates a string and has to additionally create a char array > from it. If this is the only place where the `DecimalDigits.getChars(… > char[])` is used, some extra code duplication could be removed.
If this PR can be merged, we can continue to complete PR #16006, which can also remove DecimalDigits.getChars(… char[]) ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/21593#discussion_r1807927643