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

Era.getDisplayName doesn't work with non-IsoChronology

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Withdrawn
    • Icon: P3 P3
    • tbd
    • core-libs
    • None
    • source
    • minimal
    • Java API
    • SE

      Summary

      Implement Era.getDisplayName() in each subclass of Era.

      Problem

      The default implementation of Era.getDisplayName doesn't work with non-IsoChronology because DateTimeFormatterBuilder.TextPrinterParser.format fails to get the Chronology of the Era.

      Solution

      In each subclass/enum of java.time.chrono.Era, override Era.getDisplayName() and return appropriate display name for the era, depending on its style and locale.

      Specification

      In java.time.chrono.{Hijrah|ThaiBuddhist|Minguo}Era enums, add the following method:

      /**
        * {@inheritDoc}
        *
        * @param style {@inheritDoc}
        * @param locale {@inheritDoc}
        */
      @Override
      public String getDisplayName(TextStyle style, Locale locale)

            naoto Naoto Sato
            okutsu Masayoshi Okutsu
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: