Skip to content

Commit 2eafa03

Browse files
author
Pavel Rappo
committedNov 1, 2021
8276234: Trivially clean up locale-related code
Reviewed-by: redestad, naoto, iris
1 parent 47e7a42 commit 2eafa03

File tree

3 files changed

+12
-13
lines changed

3 files changed

+12
-13
lines changed
 

‎src/java.base/share/classes/java/time/chrono/JapaneseChronology.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2012, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -124,7 +124,7 @@ public final class JapaneseChronology extends AbstractChronology implements Seri
124124
static final LocalGregorianCalendar JCAL =
125125
(LocalGregorianCalendar) CalendarSystem.forName("japanese");
126126

127-
// Locale for creating a JapaneseImpericalCalendar.
127+
// Locale for creating a JapaneseImperialCalendar.
128128
static final Locale LOCALE = Locale.forLanguageTag("ja-JP-u-ca-japanese");
129129

130130
/**

‎src/java.base/share/classes/sun/util/locale/BaseLocale.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2010, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -139,7 +139,7 @@ public static BaseLocale getInstance(String language, String script,
139139
region = "";
140140
}
141141
if (language == null) {
142-
language = null;
142+
language = "";
143143
}
144144
if (variant == null) {
145145
variant = "";

‎src/java.base/share/classes/sun/util/resources/LocaleData.java

+8-9
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242

4343
import java.security.AccessController;
4444
import java.security.PrivilegedAction;
45-
import java.util.Arrays;
4645
import java.util.Iterator;
4746
import java.util.List;
4847
import java.util.Locale;
@@ -205,7 +204,7 @@ public OpenListResourceBundle run() {
205204
});
206205
}
207206

208-
private static abstract class LocaleDataResourceBundleProvider
207+
private abstract static class LocaleDataResourceBundleProvider
209208
implements ResourceBundleProvider {
210209
/**
211210
* Changes baseName to its module dependent package name and
@@ -231,30 +230,30 @@ protected String toOtherBundleName(String baseName, String bundleName, Locale lo
231230
* A ResourceBundleProvider implementation for loading locale data
232231
* resource bundles except for the java.time supplementary data.
233232
*/
234-
public static abstract class CommonResourceBundleProvider extends LocaleDataResourceBundleProvider {
233+
public abstract static class CommonResourceBundleProvider extends LocaleDataResourceBundleProvider {
235234
}
236235

237236
/**
238237
* A ResourceBundleProvider implementation for loading supplementary
239238
* resource bundles for java.time.
240239
*/
241-
public static abstract class SupplementaryResourceBundleProvider extends LocaleDataResourceBundleProvider {
240+
public abstract static class SupplementaryResourceBundleProvider extends LocaleDataResourceBundleProvider {
242241
}
243242

244243
// Bundles.Strategy implementations
245244

246245
private static class LocaleDataStrategy implements Bundles.Strategy {
247246
private static final LocaleDataStrategy INSTANCE = new LocaleDataStrategy();
248247
// TODO: avoid hard-coded Locales
249-
private static Set<Locale> JAVA_BASE_LOCALES
248+
private static final Set<Locale> JAVA_BASE_LOCALES
250249
= Set.of(Locale.ROOT, Locale.ENGLISH, Locale.US, new Locale("en", "US", "POSIX"));
251250

252251
private LocaleDataStrategy() {
253252
}
254253

255254
/*
256255
* This method overrides the default implementation to search
257-
* from a prebaked locale string list to determin the candidate
256+
* from a prebaked locale string list to determine the candidate
258257
* locale list.
259258
*
260259
* @param baseName the resource bundle base name.
@@ -325,16 +324,16 @@ private static class SupplementaryStrategy extends LocaleDataStrategy {
325324
private static final SupplementaryStrategy INSTANCE
326325
= new SupplementaryStrategy();
327326
// TODO: avoid hard-coded Locales
328-
private static Set<Locale> JAVA_BASE_LOCALES
327+
private static final Set<Locale> JAVA_BASE_LOCALES
329328
= Set.of(Locale.ROOT, Locale.ENGLISH, Locale.US);
330329

331330
private SupplementaryStrategy() {
332331
}
333332

334333
@Override
335334
public List<Locale> getCandidateLocales(String baseName, Locale locale) {
336-
// Specifiy only the given locale
337-
return Arrays.asList(locale);
335+
// Specify only the given locale
336+
return List.of(locale);
338337
}
339338

340339
@Override

0 commit comments

Comments
 (0)
Please sign in to comment.