--- old/src/java.base/macosx/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java 2019-11-06 17:51:50.000000000 -0800 +++ new/src/java.base/macosx/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java 2019-11-06 17:51:49.000000000 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2016, 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 @@ -33,6 +33,7 @@ import java.text.spi.NumberFormatProvider; import java.util.Collections; import java.util.Calendar; +import java.util.HashMap; import java.util.HashSet; import java.util.Locale; import java.util.Map; @@ -550,15 +551,33 @@ } @Override - public String getDisplayName(String calType, int field, int value, - int style, Locale locale) { - return null; + public String getDisplayName(String calendarType, int field, + int value, int style, Locale locale) { + String[] names = getCalendarDisplayStrings(locale.toLanguageTag(), + field, style); + if (names != null && value >= 0 && value < names.length) { + return names[value]; + } else { + return null; + } } @Override - public Map getDisplayNames(String calType, - int field, int style, Locale locale) { - return null; + public Map getDisplayNames(String calendarType, + int field, int style, Locale locale) { + Map map = null; + String[] names = getCalendarDisplayStrings(locale.toLanguageTag(), + field, style); + if (names != null) { + map = new HashMap<>((int)Math.ceil(names.length / 0.75)); + for (int value = 0; value < names.length; value++) { + if (names[value] != null) { + map.put(names[value], value); + } + } + map = map.isEmpty() ? null : map; + } + return map; } }; } @@ -901,6 +920,9 @@ // For CalendarDataProvider private static native int getCalendarInt(String langTag, int type); + // For CalendarNameProvider + private static native String[] getCalendarDisplayStrings(String langTag, int field, int style); + // For Locale/CurrencyNameProvider private static native String getDisplayString(String langTag, int key, String value);