--- old/src/java.base/share/classes/java/text/DecimalFormat.java 2020-01-02 21:47:29.000000000 -0800
+++ new/src/java.base/share/classes/java/text/DecimalFormat.java 2020-01-02 21:47:29.000000000 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -136,14 +136,14 @@
* the same behavior as {@code "#,##0.0#;(#,##0.0#)"}.
*
*
The prefixes, suffixes, and various symbols used for infinity, digits,
- * thousands separators, decimal separators, etc. may be set to arbitrary
+ * grouping separators, decimal separators, etc. may be set to arbitrary
* values, and they will appear properly during formatting. However, care must
* be taken that the symbols and strings do not conflict, or parsing will be
* unreliable. For example, either the positive and negative prefixes or the
* suffixes must be distinct for {@code DecimalFormat.parse()} to be able
* to distinguish positive from negative values. (If they are identical, then
* {@code DecimalFormat} will behave as if no negative subpattern was
- * specified.) Another example is that the decimal separator and thousands
+ * specified.) Another example is that the decimal separator and grouping
* separator should be distinct characters, or parsing will be impossible.
*
*
The grouping separator is commonly used for thousands, but in some
@@ -203,7 +203,7 @@
*
{@code ,}
* | Number
* | Yes
- * | Grouping separator
+ * | Grouping separator or monetary grouping separator
* |
* {@code E}
* | Number
@@ -231,8 +231,8 @@
* | No
* | Currency sign, replaced by currency symbol. If
* doubled, replaced by international currency symbol.
- * If present in a pattern, the monetary decimal separator
- * is used instead of the decimal separator.
+ * If present in a pattern, the monetary decimal/grouping separators
+ * are used instead of the decimal/grouping separators.
* |
* {@code '}
* | Prefix or suffix
@@ -1103,7 +1103,9 @@
// Sets up the locale specific constants used when formatting.
// '0' is our default representation of zero.
fastPathData.zeroDelta = symbols.getZeroDigit() - '0';
- fastPathData.groupingChar = symbols.getGroupingSeparator();
+ fastPathData.groupingChar = isCurrencyFormat ?
+ symbols.getMonetaryGroupingSeparator() :
+ symbols.getGroupingSeparator();
// Sets up fractional constants related to currency/decimal pattern.
fastPathData.fractionalMaxIntBound = (isCurrencyFormat)
@@ -1774,7 +1776,9 @@
int maxIntDigits, int minIntDigits,
int maxFraDigits, int minFraDigits) {
- char grouping = symbols.getGroupingSeparator();
+ char grouping = isCurrencyFormat ?
+ symbols.getMonetaryGroupingSeparator() :
+ symbols.getGroupingSeparator();
char zero = symbols.getZeroDigit();
int zeroDelta = zero - '0'; // '0' is the DigitList representation of zero
@@ -2393,7 +2397,9 @@
char decimal = isCurrencyFormat ?
symbols.getMonetaryDecimalSeparator() :
symbols.getDecimalSeparator();
- char grouping = symbols.getGroupingSeparator();
+ char grouping = isCurrencyFormat ?
+ symbols.getMonetaryGroupingSeparator() :
+ symbols.getGroupingSeparator();
String exponentString = symbols.getExponentSeparator();
boolean sawDecimal = false;
boolean sawExponent = false;
@@ -4061,7 +4067,7 @@
/**
* True if this object represents a currency format. This determines
- * whether the monetary decimal separator is used instead of the normal one.
+ * whether the monetary decimal/grouping separators are used instead of the normal ones.
*/
private transient boolean isCurrencyFormat = false;
@@ -4346,8 +4352,8 @@
* The CURRENCY_SIGN is the standard Unicode symbol for currency. It
* is used in patterns and substituted with either the currency symbol,
* or if it is doubled, with the international currency symbol. If the
- * CURRENCY_SIGN is seen in a pattern, then the decimal separator is
- * replaced with the monetary decimal separator.
+ * CURRENCY_SIGN is seen in a pattern, then the decimal/grouping separators
+ * are replaced with the monetary decimal/grouping separators.
*
* The CURRENCY_SIGN is not localized.
*/
|