RFR: JDK-6503196: API doc for DecimalFormat::getMaximumIntegerDigits is unclear

Justin Lu jlu at openjdk.org
Tue Jan 23 18:46:37 UTC 2024


Please review this PR which clarifies some confusion for the digit getter and setter methods of DecimalFormat.

When formatting non `BigInteger` and `BigDecimal` values, DecimalFormat uses 309/340 as hard limits for integer and fraction digit limits, regardless of the value set by the user. There was some confusion, that those numbers might be returned by the getters, when in reality, they are only used internally.

Moving the 309/340 wording to the class description and linking to it reduces the repetitive wording, but also eliminates the confusion that the getters may return those values. This should be OK, as setting limits higher than those values are likely rare, so the warning does not need to be in every method description.

Additionally, `getMaximumIntegerDigits()` is updated to point to the patterns section to warn about the non-obvious rules for max integer digits.

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

Commit messages:
 - init

Changes: https://git.openjdk.org/jdk/pull/17541/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=17541&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-6503196
  Stats: 47 lines in 1 file changed: 17 ins; 22 del; 8 mod
  Patch: https://git.openjdk.org/jdk/pull/17541.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/17541/head:pull/17541

PR: https://git.openjdk.org/jdk/pull/17541


More information about the core-libs-dev mailing list