ICU-20536 Japanese era Reiwa support in ICU4J 4.8
diff --git a/icu4j/main/classes/core/src/com/ibm/icu/text/SimpleDateFormat.java b/icu4j/main/classes/core/src/com/ibm/icu/text/SimpleDateFormat.java
index e64aaed..f4d2741 100644
--- a/icu4j/main/classes/core/src/com/ibm/icu/text/SimpleDateFormat.java
+++ b/icu4j/main/classes/core/src/com/ibm/icu/text/SimpleDateFormat.java
@@ -1902,7 +1902,7 @@
                 // century, for parsed strings from "00" to "99".  Any other string
                 // is treated literally:  "2250", "-1", "1", "002".
                 /* 'yy' is the only special case, 'y' is interpreted as number. [Richard/GCL]*/
-                if (count == 2 && (pos.getIndex() - start) == 2
+                if (count == 2 && (pos.getIndex() - start) == 2 && cal.haveDefaultCentury()
                     && UCharacter.isDigit(text.charAt(start))
                     && UCharacter.isDigit(text.charAt(start+1)))
                     {
diff --git a/icu4j/main/classes/core/src/com/ibm/icu/util/Calendar.java b/icu4j/main/classes/core/src/com/ibm/icu/util/Calendar.java
index a285c42..25624e1 100644
--- a/icu4j/main/classes/core/src/com/ibm/icu/util/Calendar.java
+++ b/icu4j/main/classes/core/src/com/ibm/icu/util/Calendar.java
@@ -5571,6 +5571,21 @@
         return "unknown";
     }
 
+    /**
+     * Returns if two digit representation of year in this calendar type
+     * customarily implies a default century (i.e. 03 -> 2003).
+     * The default implementation returns <code>true</code>. A subclass may
+     * return <code>false</code> if such practice is not applicable (for example,
+     * Chinese calendar and Japanese calendar).
+     * 
+     * @return <code>true<code> if this calendar has a default century.
+     * @internal
+     * @deprecated This API is ICU internal only.
+     */
+    public boolean haveDefaultCentury() {
+        return true;
+    }
+
     // -------- BEGIN ULocale boilerplate --------
 
     /**
diff --git a/icu4j/main/classes/core/src/com/ibm/icu/util/ChineseCalendar.java b/icu4j/main/classes/core/src/com/ibm/icu/util/ChineseCalendar.java
index f07fc55..ba5f58f 100644
--- a/icu4j/main/classes/core/src/com/ibm/icu/util/ChineseCalendar.java
+++ b/icu4j/main/classes/core/src/com/ibm/icu/util/ChineseCalendar.java
@@ -1027,6 +1027,15 @@
     }
 
     /**
+     * {@inheritDoc}
+     * @internal
+     * @deprecated This API is ICU internal only.
+     */
+    public boolean haveDefaultCentury() {
+        return false;
+    }
+
+    /**
      * Override readObject.
      */
     private void readObject(ObjectInputStream stream)
diff --git a/icu4j/main/classes/core/src/com/ibm/icu/util/JapaneseCalendar.java b/icu4j/main/classes/core/src/com/ibm/icu/util/JapaneseCalendar.java
index 8bfacd2..4695c9a 100644
--- a/icu4j/main/classes/core/src/com/ibm/icu/util/JapaneseCalendar.java
+++ b/icu4j/main/classes/core/src/com/ibm/icu/util/JapaneseCalendar.java
@@ -560,6 +560,7 @@
         1912,    7, 30,     // Taisho
         1926,   12, 25,     // Showa
         1989,    1,  8,     // Heisei
+        2019,    5,  1,     // Reiwa
     };
 
     //-------------------------------------------------------------------------
@@ -576,25 +577,25 @@
      * Constant for the era starting on Sept. 8, 1868 AD.
      * @stable  ICU 2.8 
      */
-    static public final int MEIJI = CURRENT_ERA - 3;
+    static public final int MEIJI = CURRENT_ERA - 4;
 
     /** 
      * Constant for the era starting on July 30, 1912 AD. 
      * @stable ICU 2.8 
      */
-    static public final int TAISHO = CURRENT_ERA - 2;
+    static public final int TAISHO = CURRENT_ERA - 3;
     
     /** 
      * Constant for the era starting on Dec. 25, 1926 AD. 
      * @stable ICU 2.8 
      */
-    static public final int SHOWA = CURRENT_ERA - 1;
+    static public final int SHOWA = CURRENT_ERA - 2;
 
     /** 
      * Constant for the era starting on Jan. 7, 1989 AD. 
      * @stable ICU 2.8 
      */
-    static public final int HEISEI = CURRENT_ERA;
+    static public final int HEISEI = CURRENT_ERA - 1;
 
     /**
      * Override GregorianCalendar.  We should really handle YEAR_WOY and
@@ -638,6 +639,15 @@
 
     /**
      * {@inheritDoc}
+     * @internal
+     * @deprecated This API is ICU internal only.
+     */
+    public boolean haveDefaultCentury() {
+        return false;
+    }
+
+    /**
+     * {@inheritDoc}
      * @stable ICU 4.0
      */
     public int getActualMaximum(int field) {
diff --git a/icu4j/main/shared/data/icudata.jar b/icu4j/main/shared/data/icudata.jar
index 86c9168..81fd472 100755
--- a/icu4j/main/shared/data/icudata.jar
+++ b/icu4j/main/shared/data/icudata.jar
@@ -1,3 +1,3 @@
 version https://git-lfs.github.com/spec/v1
-oid sha256:0b69f677bf8dcf1da58e140eb6cf7bfb601f734083658c93f683ddee38701b21
-size 7959246
+oid sha256:7b691dc0b0209976358d6a4c7d034d24973a7720b4faff8d506c8e2aab3051cd
+size 7996157
diff --git a/icu4j/main/shared/data/testdata.jar b/icu4j/main/shared/data/testdata.jar
index e0c7361..ef06ab6 100755
--- a/icu4j/main/shared/data/testdata.jar
+++ b/icu4j/main/shared/data/testdata.jar
@@ -1,3 +1,3 @@
 version https://git-lfs.github.com/spec/v1
-oid sha256:42db4296cb01c693cf205b1047493298d1abbdefcb6801e04014e5011886ba19
-size 719075
+oid sha256:aedf1a1a084013b2db88dfb57cc83ad5d76c068981c556c70b3909e3e1069c82
+size 719066
diff --git a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/calendar/JapaneseTest.java b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/calendar/JapaneseTest.java
index cca9cdf..ce3fee7 100644
--- a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/calendar/JapaneseTest.java
+++ b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/calendar/JapaneseTest.java
@@ -148,9 +148,9 @@
         Calendar cal = new JapaneseCalendar(loc);
         DateFormat enjformat = cal.getDateTimeFormat(0,0,new ULocale("en_JP@calendar=japanese"));
         DateFormat format = cal.getDateTimeFormat(0,0,loc);
-        ((SimpleDateFormat)format).applyPattern("y.M.d");  // Note: just 'y' doesn't work here.
+        ((SimpleDateFormat)format).applyPattern("y/M/d");  // Note: just 'y' doesn't work here.
         ParsePosition pos = new ParsePosition(0);
-        Date aDate = format.parse("1.1.9", pos); // after the start of heisei accession.  Jan 1, 1H wouldn't work  because it is actually showa 64
+        Date aDate = format.parse("1/5/9", pos); // after the start of Reiwa accession.  Jan 1, 1R wouldn't work  because it is actually Heisei 31
         String inEn = enjformat.format(aDate);
 
         cal.clear();
@@ -159,7 +159,7 @@
         int gotEra = cal.get(Calendar.ERA);
         
         int expectYear = 1;
-        int expectEra = JapaneseCalendar.CURRENT_ERA;
+        int expectEra = JapaneseCalendar.CURRENT_ERA;   // Reiwa
         
         if((gotYear != expectYear) || (gotEra != expectEra)) {
             errln("Expected year " + expectYear + ", era " + expectEra +", but got year " + gotYear + " and era " + gotEra + ", == " + inEn);
@@ -167,7 +167,7 @@
             logln("Got year " + gotYear + " and era " + gotEra + ", == " + inEn);
         }
 
-        // Test parse with missing era (should default to current era, heisei)
+        // Test parse with missing era (should default to current era)
         // Test parse with incomplete information
         logln("Testing parse w/ just year...");
         Calendar cal2 = new JapaneseCalendar(loc);
@@ -191,7 +191,7 @@
         gotYear = cal2.get(Calendar.YEAR);
         gotEra = cal2.get(Calendar.ERA);
         expectYear = 1;
-        expectEra = JapaneseCalendar.CURRENT_ERA;
+        expectEra = JapaneseCalendar.CURRENT_ERA;   // Reiwa
         if((gotYear != 1) || (gotEra != expectEra)) {
             errln("parse "+ samplestr + " of 'y' as Japanese Calendar, expected year " + expectYear + 
                 " and era " + expectEra + ", but got year " + gotYear + " and era " + gotEra + " (Gregorian:" + str +")");
@@ -370,5 +370,30 @@
         doLimitsTest(jcal, null, cal.getTime());
         doTheoreticalLimitsTest(jcal, true);
     }
+
+    public void TestHeiseiToReiwa() {
+        Calendar cal = Calendar.getInstance();
+        cal.set(2019, Calendar.APRIL, 29);
+
+        DateFormat jfmt = DateFormat.getDateInstance(DateFormat.LONG, new ULocale("ja@calendar=japanese"));
+
+        final String[] EXPECTED_FORMAT = {
+                "\u5E73\u621031\u5E744\u670829\u65E5",  // Heisei 31 April 29
+                "\u5E73\u621031\u5E744\u670830\u65E5",  // Heisei 31 April 30
+                "\u4EE4\u548C1\u5E745\u67081\u65E5",    // Reiwa 1 May 1
+                "\u4EE4\u548C1\u5E745\u67082\u65E5",    // Reiwa 1 May 2
+        };
+
+        for (int i = 0; i < EXPECTED_FORMAT.length; i++) {
+            Date d = cal.getTime();
+            String dateStr = jfmt.format(d);
+            if (!EXPECTED_FORMAT[i].equals(dateStr)) {
+                errln("Formatting year:" + cal.get(Calendar.YEAR) + " month:" + (cal.get(Calendar.MONTH) + 1)
+                        + " day:" + cal.get(Calendar.DATE) + " - expected: " + EXPECTED_FORMAT[i]
+                        + " / actual: " + dateStr);
+            }
+            cal.add(Calendar.DATE, 1);
+        }
+    }
 }
 
diff --git a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/DateFormatTest.java b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/DateFormatTest.java
index f6f0dec..d4d93a6 100644
--- a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/DateFormatTest.java
+++ b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/DateFormatTest.java
@@ -1813,11 +1813,11 @@
         DateFormat fmt = DateFormat.getDateInstance(DateFormat.SHORT, Locale.US);
         Calendar cal = Calendar.getInstance();
         cal.clear();
-        cal.set(117 + 1900, Calendar.JUNE, 5);
-        parse2DigitYear(fmt, "6/5/17", cal.getTime());
+        cal.set(130 + 1900, Calendar.JUNE, 5);
+        parse2DigitYear(fmt, "6/5/30", cal.getTime());
         cal.clear();
-        cal.set(34 + 1900, Calendar.JUNE, 4);
-        parse2DigitYear(fmt, "6/4/34", cal.getTime());
+        cal.set(50 + 1900, Calendar.JUNE, 4);
+        parse2DigitYear(fmt, "6/4/50", cal.getTime());
     }
     
     // internal test subroutine, used by TestTwoDigitYear
diff --git a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/util/DebugUtilitiesData.java b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/util/DebugUtilitiesData.java
index d15bfce..5605c4c 100644
--- a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/util/DebugUtilitiesData.java
+++ b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/util/DebugUtilitiesData.java
@@ -1,4 +1,4 @@
-/** Copyright (C) 2007-2012, International Business Machines Corporation and Others. All Rights Reserved. **/
+/** Copyright (C) 2007-2019, International Business Machines Corporation and Others. All Rights Reserved. **/
 
 /* NOTE: this file is AUTOMATICALLY GENERATED by gentest.
  * See: {ICU4C}/source/data/icu4j-readme.txt for more information.