> Please review this PR and [CSR](https://bugs.openjdk.org/browse/JDK-8314607) > which clarifies the behavior of patterns in regards to the max integer > digits in j.text.DecimalFormat. > > The current specification (of `applyPattern`) states that patterns do not set > the value of max integer digits. This is incorrect, these > methods/constructors do set a value for the max integer digits. If the > pattern is in scientific notation, the max integer digits value is derived > from the pattern. Otherwise, the pattern is ignored, and the limit is set to > `Integer.MAX_VALUE`. > > See below, > > DecimalFormat df = new DecimalFormat(); > df.applyPattern("000.000E0"); > df.getMaximumIntegerDigits(); // ==> 3 > df.applyPattern("000.000"); > df.getMaximumIntegerDigits(); // ==> 2147483647 > > DecimalFormat df = new DecimalFormat("000.000"); > df.getMaximumIntegerDigits(); // ==> 2147483647 > DecimalFormat df = new DecimalFormat("000.000E0"); > df.getMaximumIntegerDigits(); // ==> 3 > > > Method descriptions should be fixed, and the relevant constructors need to > mention the behavior as well.
Justin Lu has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains six additional commits since the last revision: - Reflect CSR comment, use anchor and reference - Merge branch 'master' into JDK-8314604 - Reflect review comments: Non sci notation first. Link to Scientific Notation section - Include constructors - Re-clarify spec - Init ------------- Changes: - all: https://git.openjdk.org/jdk/pull/15349/files - new: https://git.openjdk.org/jdk/pull/15349/files/93b0053e..258ce6d8 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=15349&range=02 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=15349&range=01-02 Stats: 16482 lines in 501 files changed: 11217 ins; 2724 del; 2541 mod Patch: https://git.openjdk.org/jdk/pull/15349.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/15349/head:pull/15349 PR: https://git.openjdk.org/jdk/pull/15349