-
CSR
-
Resolution: Approved
-
P3
-
None
-
minimal
-
The newly added serializable fields are not accessible via public APIs, hence the compatibility risk is minimal.
-
Other
-
SE
Summary
Add serializable String
fields in java.text.DecimalFormatSymbols
for percent, per mille, and minus sign, parallel to corresponding fields of their char
variations.
Problem
As demonstrated in JDK-8220224, a single char
is not sufficient to represent those symbols for BiDi languages, which may include Directional Formatting Characters in those symbols.
Solution
Define String
variation of those existing symbol fields. These fields are to retain the symbols beyond serialization/deserialization, thus should be @serial
. These fields are used internally to the java.text
package using data read from the CLDR resources. Although it may be considered at a later time (JDK-8220309), no new public API is provided to directly access those fields.
Specification
Add the following serializable fields in java.text.DecimalFormatSymbols
/**
* String representation of per mille sign, which may include
* formatting characters, such as BiDi control characters.
* The first non-format character of this string is the same as
* <code>perMill</code>.
*
* @serial
* @since 13
*/
private String perMillText;
/**
* String representation of percent sign, which may include
* formatting characters, such as BiDi control characters.
* The first non-format character of this string is the same as
* <code>percent</code>.
*
* @serial
* @since 13
*/
private String percentText;
/**
* String representation of minus sign, which may include
* formatting characters, such as BiDi control characters.
* The first non-format character of this string is the same as
* <code>minusSign</code>.
*
* @serial
* @since 13
*/
private String minusSignText;
Change the method description of DecimalFormatSymbols#readObject()
from:
/**
* Reads the default serializable fields, provides default values for objects
* in older serial versions, and initializes non-serializable fields.
* If <code>serialVersionOnStream</code>
* is less than 1, initializes <code>monetarySeparator</code> to be
* the same as <code>decimalSeparator</code> and <code>exponential</code>
* to be 'E'.
* If <code>serialVersionOnStream</code> is less than 2,
* initializes <code>locale</code>to the root locale, and initializes
* If <code>serialVersionOnStream</code> is less than 3, it initializes
* <code>exponentialSeparator</code> using <code>exponential</code>.
* Sets <code>serialVersionOnStream</code> back to the maximum allowed value so that
* default serialization will work properly if this object is streamed out again.
* Initializes the currency from the intlCurrencySymbol field.
*
* @since 1.1.6
*/
to:
/**
* Reads the default serializable fields, provides default values for objects
* in older serial versions, and initializes non-serializable fields.
* If <code>serialVersionOnStream</code>
* is less than 1, initializes <code>monetarySeparator</code> to be
* the same as <code>decimalSeparator</code> and <code>exponential</code>
* to be 'E'.
* If <code>serialVersionOnStream</code> is less than 2,
* initializes <code>locale</code>to the root locale, and initializes
* If <code>serialVersionOnStream</code> is less than 3, it initializes
* <code>exponentialSeparator</code> using <code>exponential</code>.
* If <code>serialVersionOnStream</code> is less than 4, it initializes
* <code>perMillText</code>, <code>percentText</code>, and
* <code>minusSignText</code> using <code>perMill</code>, <code>percent</code>, and
* <code>minusSign</code> respectively.
* Sets <code>serialVersionOnStream</code> back to the maximum allowed value so that
* default serialization will work properly if this object is streamed out again.
* Initializes the currency from the intlCurrencySymbol field.
*
* @throws InvalidObjectException if <code>char</code> and <code>String</code>
* representations of either percent, per mille, and/or minus sign disagree.
* @since 1.1.6
*/
- csr of
-
JDK-8220224 With CLDR provider, NumberFormat.format could not handle locale with number extension correctly.
- Resolved