8282819: Deprecate Locale class constructors

Reviewed-by: lancea, rriggs
This commit is contained in:
Naoto Sato 2022-04-05 15:38:36 +00:00
parent 648efd7abc
commit 526e73498e
15 changed files with 256 additions and 73 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2022, 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
@ -35,10 +35,10 @@ import java.util.Locale;
* @author Masayoshi Okutsu
*/
public class JRELocaleConstants {
public static final Locale JA_JP_JP = new Locale("ja", "JP", "JP");
public static final Locale NO_NO_NY = new Locale("no", "NO", "NY");
public static final Locale TH_TH = new Locale("th", "TH");
public static final Locale TH_TH_TH = new Locale("th", "TH", "TH");
public static final Locale JA_JP_JP = Locale.of("ja", "JP", "JP");
public static final Locale NO_NO_NY = Locale.of("no", "NO", "NY");
public static final Locale TH_TH = Locale.of("th", "TH");
public static final Locale TH_TH_TH = Locale.of("th", "TH", "TH");
private JRELocaleConstants() {
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2022, 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
@ -369,7 +369,7 @@ public final class LocaleServiceProviderPool {
"A locale(" + locale + ") has non-empty extensions, but has illformed fields.");
// Fallback - script field will be lost.
lookupLocale = new Locale(locale.getLanguage(), locale.getCountry(), locale.getVariant());
lookupLocale = Locale.of(locale.getLanguage(), locale.getCountry(), locale.getVariant());
}
}
return lookupLocale;

View file

@ -246,7 +246,7 @@ public class LocaleData {
private static final LocaleDataStrategy INSTANCE = new LocaleDataStrategy();
// TODO: avoid hard-coded Locales
private static final Set<Locale> JAVA_BASE_LOCALES
= Set.of(Locale.ROOT, Locale.ENGLISH, Locale.US, new Locale("en", "US", "POSIX"));
= Set.of(Locale.ROOT, Locale.ENGLISH, Locale.US, Locale.of("en", "US", "POSIX"));
private LocaleDataStrategy() {
}