Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8282687

Access required for java.text.DecimalFormatSymbol.locale

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P3 P3
    • 19
    • core-libs
    • None
    • source
    • minimal
    • Adding access to existing field. The locale is a benign value, and would have been required to retrieve the DecimalFormatSymbol originally.
    • Java API
    • SE

      Summary

      Provide public access to DecimalFormatSymbol's locale to improve caching of DecimalFormatSymbols in java.util.Formatter.

      Problem

      Formatting of numerics in java.util.Formatter takes a significant performance hit due an expensive retrieval (requires a new instance) of the locale's DecimalFormatSymbol anytime a locale may have changed.

      Solution

      The retrieval of the DecimalFormatSymbol can be skipped if java.util.Formatter can quickly determine that a cached DecimalFormatSymbol is valid for the current locale. This can be achieved by providing a public accessor to DecimalFormatSymbol.locale.

      Specification

      +    /**
      +     * {@return locale used to create this instance}
      +     *
      +     * @since 19
      +     */
      +    public Locale getLocale() {
      +        return locale;
      +    }
      +

            jlaskey Jim Laskey
            jlaskey Jim Laskey
            Naoto Sato, Roger Riggs
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: