RFR 8171049: Era.getDisplayName doesn't work with non-IsoChronology
naoto.sato at oracle.com
Fri Aug 25 21:39:19 UTC 2017
On 8/25/17 11:04 AM, Naoto Sato wrote:
> Hi Stephen, thanks for the review.
> On 8/25/17 10:49 AM, Stephen Colebourne wrote:
>> The formatter should be a static constant in both cases - no need to
>> create each time.
> Yes, that can be done.
I further looked at this, but it seems the Builder and Formatter have to
be created on each getDisplayName() call, as getDisplayName takes
"style" and "locale" which need to be applied to Formatter. It's
possible to call withLocale(locale), but not for "style".
As to having static Builder, once it is created with an Era text with a
specific TextStyle, it seems there is no way to reset it at a later
time. Do I understand it correctly?
>> I would have expected this to be done without using DateTimeFormatter
>> however, just directly calling an internal API.
> Which internal API?
I was trying to Roger's suggestion, but this also seems to be not
possible, as DateTimeTextProvider is java.time.format package private,
and each Era implementation resides in java.time.chrono package.
So, if there is no other comment/suggestion, I would like to propose the
webrev as it is. In fact, I pretty much copied the default
implementation from Era.getDisplayName() with necessary modifications.
>> On 25 August 2017 at 18:43, Naoto Sato <naoto.sato at oracle.com> wrote:
>>> Please review the fix to the following issue:
>>> The proposed fix is located at:
>>> The fix is to implement Era.getDisplayName() in each Era enum.
More information about the core-libs-dev