8330802
: Desugar switch in Locale::createLocale
Reviewed-by: alanb, liach, rriggs, naoto, mchung
This commit is contained in:
parent
8961077056
commit
daa5a4bd12
@ -995,11 +995,11 @@ public final class Locale implements Cloneable, Serializable {
|
|||||||
|
|
||||||
private static final ReferencedKeyMap<Object, Locale> LOCALE_CACHE = ReferencedKeyMap.create(true, ConcurrentHashMap::new);
|
private static final ReferencedKeyMap<Object, Locale> LOCALE_CACHE = ReferencedKeyMap.create(true, ConcurrentHashMap::new);
|
||||||
private static Locale createLocale(Object key) {
|
private static Locale createLocale(Object key) {
|
||||||
return switch (key) {
|
if (key instanceof BaseLocale base) {
|
||||||
case BaseLocale base -> new Locale(base, null);
|
return new Locale(base, null);
|
||||||
case LocaleKey lk -> new Locale(lk.base, lk.exts);
|
}
|
||||||
default -> throw new InternalError("should not happen");
|
LocaleKey lk = (LocaleKey)key;
|
||||||
};
|
return new Locale(lk.base, lk.exts);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final class LocaleKey {
|
private static final class LocaleKey {
|
||||||
|
Loading…
Reference in New Issue
Block a user