mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-10 07:39:16 +00:00
ICU-22444 Remove "unknown" from Calendar.getKeywordValuesForLocale
Remove CalType enum value UNKNOWN and use null for unknown CalType This value is an internal enum and the only place use it is inside Calendar.java Use null for that instead (same as C++)
This commit is contained in:
parent
03e98c04f3
commit
73b61ceece
3 changed files with 6 additions and 5 deletions
|
@ -26,9 +26,7 @@ public enum CalType {
|
|||
ISLAMIC_UMALQURA("islamic-umalqura"),
|
||||
JAPANESE("japanese"),
|
||||
PERSIAN("persian"),
|
||||
ROC("roc"),
|
||||
|
||||
UNKNOWN("unknown");
|
||||
ROC("roc");
|
||||
|
||||
String id;
|
||||
|
||||
|
|
|
@ -1814,14 +1814,14 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
|
|||
}
|
||||
}
|
||||
}
|
||||
return CalType.UNKNOWN;
|
||||
return null;
|
||||
}
|
||||
|
||||
private static Calendar createInstance(ULocale locale) {
|
||||
Calendar cal = null;
|
||||
TimeZone zone = TimeZone.forULocaleOrDefault(locale);
|
||||
CalType calType = getCalendarTypeForLocale(locale);
|
||||
if (calType == CalType.UNKNOWN) {
|
||||
if (calType == null) {
|
||||
// fallback to Gregorian
|
||||
calType = CalType.GREGORIAN;
|
||||
}
|
||||
|
|
|
@ -2186,6 +2186,9 @@ public class CalendarRegressionTest extends com.ibm.icu.dev.test.TestFmwk {
|
|||
String[] ALL = Calendar.getKeywordValuesForLocale("calendar", ULocale.getDefault(), false);
|
||||
HashSet ALLSET = new HashSet();
|
||||
for (int i = 0; i < ALL.length; i++) {
|
||||
if (ALL[i] == "unknown") {
|
||||
errln("Calendar.getKeywordValuesForLocale should not return \"unknown\"");
|
||||
}
|
||||
ALLSET.add(ALL[i]);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue