Skip to content

Commit 3d32c46

Browse files
author
Justin Lu
committed
6503196: API doc for DecimalFormat::getMaximumIntegerDigits is unclear
Reviewed-by: naoto, iris
1 parent 2d5cb97 commit 3d32c46

File tree

1 file changed

+24
-29
lines changed

1 file changed

+24
-29
lines changed

src/java.base/share/classes/java/text/DecimalFormat.java

Lines changed: 24 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,15 @@
352352
* digits as well as all Unicode decimal digits, as defined by
353353
* {@link Character#digit Character.digit}, are recognized.
354354
*
355+
* <h3 id="digit_limits"> Integer and Fraction Digit Limits </h3>
356+
*
357+
* @implSpec
358+
* When formatting a {@code Number} other than {@code BigInteger} and
359+
* {@code BigDecimal}, {@code 309} is used as the upper limit for integer digits,
360+
* and {@code 340} as the upper limit for fraction digits. This occurs, even if
361+
* one of the {@code DecimalFormat} getter methods, for example, {@link #getMinimumFractionDigits()}
362+
* returns a numerically greater value.
363+
*
355364
* <h4>Special Values</h4>
356365
*
357366
* <p>Not a Number({@code NaN}) is formatted as a string, which typically has a
@@ -3718,11 +3727,9 @@ else if (ch == percent) {
37183727

37193728
/**
37203729
* Sets the maximum number of digits allowed in the integer portion of a
3721-
* number.
3722-
* For formatting numbers other than {@code BigInteger} and
3723-
* {@code BigDecimal} objects, the lower of {@code newValue} and
3724-
* 309 is used. Negative input values are replaced with 0.
3730+
* number. Negative input values are replaced with 0.
37253731
* @see NumberFormat#setMaximumIntegerDigits
3732+
* @see ##digit_limits Integer and Fraction Digit Limits
37263733
*/
37273734
@Override
37283735
public void setMaximumIntegerDigits(int newValue) {
@@ -3737,11 +3744,9 @@ public void setMaximumIntegerDigits(int newValue) {
37373744

37383745
/**
37393746
* Sets the minimum number of digits allowed in the integer portion of a
3740-
* number.
3741-
* For formatting numbers other than {@code BigInteger} and
3742-
* {@code BigDecimal} objects, the lower of {@code newValue} and
3743-
* 309 is used. Negative input values are replaced with 0.
3747+
* number. Negative input values are replaced with 0.
37443748
* @see NumberFormat#setMinimumIntegerDigits
3749+
* @see ##digit_limits Integer and Fraction Digit Limits
37453750
*/
37463751
@Override
37473752
public void setMinimumIntegerDigits(int newValue) {
@@ -3756,11 +3761,9 @@ public void setMinimumIntegerDigits(int newValue) {
37563761

37573762
/**
37583763
* Sets the maximum number of digits allowed in the fraction portion of a
3759-
* number.
3760-
* For formatting numbers other than {@code BigInteger} and
3761-
* {@code BigDecimal} objects, the lower of {@code newValue} and
3762-
* 340 is used. Negative input values are replaced with 0.
3764+
* number. Negative input values are replaced with 0.
37633765
* @see NumberFormat#setMaximumFractionDigits
3766+
* @see ##digit_limits Integer and Fraction Digit Limits
37643767
*/
37653768
@Override
37663769
public void setMaximumFractionDigits(int newValue) {
@@ -3775,11 +3778,9 @@ public void setMaximumFractionDigits(int newValue) {
37753778

37763779
/**
37773780
* Sets the minimum number of digits allowed in the fraction portion of a
3778-
* number.
3779-
* For formatting numbers other than {@code BigInteger} and
3780-
* {@code BigDecimal} objects, the lower of {@code newValue} and
3781-
* 340 is used. Negative input values are replaced with 0.
3781+
* number. Negative input values are replaced with 0.
37823782
* @see NumberFormat#setMinimumFractionDigits
3783+
* @see ##digit_limits Integer and Fraction Digit Limits
37833784
*/
37843785
@Override
37853786
public void setMinimumFractionDigits(int newValue) {
@@ -3794,11 +3795,11 @@ public void setMinimumFractionDigits(int newValue) {
37943795

37953796
/**
37963797
* Gets the maximum number of digits allowed in the integer portion of a
3797-
* number.
3798-
* For formatting numbers other than {@code BigInteger} and
3799-
* {@code BigDecimal} objects, the lower of the return value and
3800-
* 309 is used.
3798+
* number. The maximum number of integer digits can be set by either {@link #setMaximumIntegerDigits(int)}
3799+
* or {@link #applyPattern(String)}. See the {@link ##patterns Pattern Section} for
3800+
* comprehensive rules regarding maximum integer digits in patterns.
38013801
* @see #setMaximumIntegerDigits
3802+
* @see ##digit_limits Integer and Fraction Digit Limits
38023803
*/
38033804
@Override
38043805
public int getMaximumIntegerDigits() {
@@ -3808,10 +3809,8 @@ public int getMaximumIntegerDigits() {
38083809
/**
38093810
* Gets the minimum number of digits allowed in the integer portion of a
38103811
* number.
3811-
* For formatting numbers other than {@code BigInteger} and
3812-
* {@code BigDecimal} objects, the lower of the return value and
3813-
* 309 is used.
38143812
* @see #setMinimumIntegerDigits
3813+
* @see ##digit_limits Integer and Fraction Digit Limits
38153814
*/
38163815
@Override
38173816
public int getMinimumIntegerDigits() {
@@ -3821,10 +3820,8 @@ public int getMinimumIntegerDigits() {
38213820
/**
38223821
* Gets the maximum number of digits allowed in the fraction portion of a
38233822
* number.
3824-
* For formatting numbers other than {@code BigInteger} and
3825-
* {@code BigDecimal} objects, the lower of the return value and
3826-
* 340 is used.
38273823
* @see #setMaximumFractionDigits
3824+
* @see ##digit_limits Integer and Fraction Digit Limits
38283825
*/
38293826
@Override
38303827
public int getMaximumFractionDigits() {
@@ -3834,10 +3831,8 @@ public int getMaximumFractionDigits() {
38343831
/**
38353832
* Gets the minimum number of digits allowed in the fraction portion of a
38363833
* number.
3837-
* For formatting numbers other than {@code BigInteger} and
3838-
* {@code BigDecimal} objects, the lower of the return value and
3839-
* 340 is used.
38403834
* @see #setMinimumFractionDigits
3835+
* @see ##digit_limits Integer and Fraction Digit Limits
38413836
*/
38423837
@Override
38433838
public int getMinimumFractionDigits() {

0 commit comments

Comments
 (0)