8205432: Replace the placeholder Japanese era name

Reviewed-by: rriggs, chegar
This commit is contained in:
Naoto Sato 2019-04-01 08:19:21 -07:00
parent 2cc859d380
commit 2a510a6353
29 changed files with 134 additions and 109 deletions

View file

@ -151,14 +151,14 @@ public final class JapaneseEra
*/
public static final JapaneseEra HEISEI = new JapaneseEra(2, LocalDate.of(1989, 1, 8));
/**
* The singleton instance for the 'NewEra' era (2019-05-01 - current)
* The singleton instance for the 'Reiwa' era (2019-05-01 - )
* which has the value 3.
*/
private static final JapaneseEra NEWERA = new JapaneseEra(3, LocalDate.of(2019, 5, 1));
private static final JapaneseEra REIWA = new JapaneseEra(3, LocalDate.of(2019, 5, 1));
// The number of predefined JapaneseEra constants.
// There may be a supplemental era defined by the property.
private static final int N_ERA_CONSTANTS = NEWERA.getValue() + ERA_OFFSET;
private static final int N_ERA_CONSTANTS = REIWA.getValue() + ERA_OFFSET;
/**
* Serialization version.
@ -176,7 +176,7 @@ public final class JapaneseEra
KNOWN_ERAS[1] = TAISHO;
KNOWN_ERAS[2] = SHOWA;
KNOWN_ERAS[3] = HEISEI;
KNOWN_ERAS[4] = NEWERA;
KNOWN_ERAS[4] = REIWA;
for (int i = N_ERA_CONSTANTS; i < ERA_CONFIG.length; i++) {
CalendarDate date = ERA_CONFIG[i].getSinceDate();
LocalDate isoDate = LocalDate.of(date.getYear(), date.getMonth(), date.getDayOfMonth());

View file

@ -50,7 +50,7 @@ import sun.util.calendar.ZoneInfo;
* 2 Taisho 1912-07-30T00:00:00 local time
* 3 Showa 1926-12-25T00:00:00 local time
* 4 Heisei 1989-01-08T00:00:00 local time
* 5 NewEra 2019-05-01T00:00:00 local time
* 5 Reiwa 2019-05-01T00:00:00 local time
* ------------------------------------------------------
* }</pre>
*
@ -129,9 +129,9 @@ class JapaneseImperialCalendar extends Calendar {
public static final int HEISEI = 4;
/**
* The ERA constant designating the NewEra era.
* The ERA constant designating the Reiwa era.
*/
private static final int NEWERA = 5;
private static final int REIWA = 5;
private static final int EPOCH_OFFSET = 719163; // Fixed date of January 1, 1970 (Gregorian)
@ -1761,12 +1761,12 @@ class JapaneseImperialCalendar extends Calendar {
}
} else if (transitionYear) {
if (jdate.getYear() == 1) {
// As of NewEra (since Meiji) there's no case
// As of Reiwa (since Meiji) there's no case
// that there are multiple transitions in a
// year. Historically there was such
// case. There might be such case again in the
// future.
if (era > NEWERA) {
if (era > REIWA) {
CalendarDate pd = eras[era - 1].getSinceDate();
if (normalizedYear == pd.getYear()) {
d.setMonth(pd.getMonth()).setDayOfMonth(pd.getDayOfMonth());

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -106,7 +106,7 @@ public class FormatData extends ParallelListResourceBundle {
"T",
"S",
"H",
"N", // NewEra
"R",
};
// Japanese imperial calendar era strings
@ -116,7 +116,7 @@ public class FormatData extends ParallelListResourceBundle {
"Taisho",
"Showa",
"Heisei",
"NewEra", // NewEra
"Reiwa",
};
return new Object[][] {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -159,7 +159,7 @@ public class JavaTimeSupplementary extends OpenListResourceBundle {
"Taisho",
"Showa",
"Heisei",
"NewEra", // New Era
"Reiwa",
};
final String[] sharedShortEras = {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -48,7 +48,7 @@ import java.util.TimeZone;
* Taisho 1912-07-30T00:00:00 local time
* Showa 1926-12-25T00:00:00 local time
* Heisei 1989-01-08T00:00:00 local time
* NewEra 2019-05-01T00:00:00 local time
* Reiwa 2019-05-01T00:00:00 local time
* -----------------------------------------------------------------------
* }</pre>
*

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -43,7 +43,7 @@ public class LocalGregorianCalendar extends BaseCalendar {
new Era("Taisho", "T", -1812153600000L, true),
new Era("Showa", "S", -1357603200000L, true),
new Era("Heisei", "H", 600220800000L, true),
new Era("NewEra", "N", 1556668800000L, true),
new Era("Reiwa", "R", 1556668800000L, true),
};
private static boolean isValidEra(Era newEra, Era[] eras) {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -84,10 +84,10 @@ public class CalendarNameProviderImpl extends CalendarNameProvider implements Av
Era[] jeras = CalendarSystem.forName("japanese").getEras();
if (value <= jeras.length) {
// Localized era name could not be retrieved from this provider.
// This can occur either for NewEra or SupEra.
// This can occur either for Reiwa or SupEra.
//
// If it's CLDR provider, try COMPAT first, which is guaranteed to have
// the name for NewEra.
// the name for Reiwa.
if (type == LocaleProviderAdapter.Type.CLDR) {
lr = LocaleProviderAdapter.forJRE().getLocaleResources(locale);
key = getResourceKeyFor(LocaleProviderAdapter.Type.JRE,