[10] RFR 8171049: Era.getDisplayName doesn't work with non-IsoChronology

Roger Riggs Roger.Riggs at Oracle.com
Mon Aug 28 14:35:36 UTC 2017


Hi Naoto,

Thanks for following up on the suggestions.

I agree your original proposal find, as is, the alternative APIs are 
package private and are not readily available.
And I agree a static builder would not be valuable since it is not 
reusable and it would not be a good
use of memory since it is infrequency used.

Ok, as is,

Thanks, Roger

On 8/25/2017 5:39 PM, Naoto Sato wrote:
> 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.
>
> Naoto
>
>>
>> Naoto
>>
>>>
>>> Stephen
>>>
>>>
>>>
>>>
>>> On 25 August 2017 at 18:43, Naoto Sato <naoto.sato at oracle.com> wrote:
>>>> Hi,
>>>>
>>>> Please review the fix to the following issue:
>>>>
>>>> https://bugs.openjdk.java.net/browse/JDK-8171049
>>>>
>>>> The proposed fix is located at:
>>>>
>>>> http://cr.openjdk.java.net/~naoto/8171049/webrev.00/
>>>>
>>>> The fix is to implement Era.getDisplayName() in each Era enum.
>>>>
>>>> Naoto



More information about the core-libs-dev mailing list