Skip to content

Commit

Permalink
8330802: Desugar switch in Locale::createLocale
Browse files Browse the repository at this point in the history
Reviewed-by: alanb, liach, rriggs, naoto, mchung
  • Loading branch information
cl4es committed Apr 23, 2024
1 parent 8961077 commit daa5a4b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/java.base/share/classes/java/util/Locale.java
Original file line number Diff line number Diff line change
Expand Up @@ -995,11 +995,11 @@ static Locale getInstance(BaseLocale baseloc, LocaleExtensions extensions) {

private static final ReferencedKeyMap<Object, Locale> LOCALE_CACHE = ReferencedKeyMap.create(true, ConcurrentHashMap::new);
private static Locale createLocale(Object key) {
return switch (key) {
case BaseLocale base -> new Locale(base, null);
case LocaleKey lk -> new Locale(lk.base, lk.exts);
default -> throw new InternalError("should not happen");
};
if (key instanceof BaseLocale base) {
return new Locale(base, null);
}
LocaleKey lk = (LocaleKey)key;
return new Locale(lk.base, lk.exts);
}

private static final class LocaleKey {
Expand Down

1 comment on commit daa5a4b

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.