ICU-21249 ICU4J 68 API status updates
See https://docs.google.com/spreadsheets/d/1OIezmSf2mN-hiRnIrpwugCHTzCFIm_-GyeA3ng4QFP8
diff --git a/icu4j/main/classes/core/src/com/ibm/icu/number/Precision.java b/icu4j/main/classes/core/src/com/ibm/icu/number/Precision.java
index a984ae0..0b46cf6 100644
--- a/icu4j/main/classes/core/src/com/ibm/icu/number/Precision.java
+++ b/icu4j/main/classes/core/src/com/ibm/icu/number/Precision.java
@@ -559,7 +559,22 @@
*/
@Deprecated
public static class BogusRounder extends Precision {
+ /**
+ * Default constructor.
+ * @internal
+ * @deprecated This API is ICU internal only.
+ */
+ @Deprecated
+ public BogusRounder() {
+ }
+
+ /**
+ * {@inheritDoc}
+ * @internal
+ * @deprecated This API is ICU internal only.
+ */
@Override
+ @Deprecated
public void apply(DecimalQuantity value) {
throw new AssertionError("BogusRounder must not be applied");
}
diff --git a/icu4j/main/classes/core/src/com/ibm/icu/text/RelativeDateTimeFormatter.java b/icu4j/main/classes/core/src/com/ibm/icu/text/RelativeDateTimeFormatter.java
index dce26bc..14b2fbd 100644
--- a/icu4j/main/classes/core/src/com/ibm/icu/text/RelativeDateTimeFormatter.java
+++ b/icu4j/main/classes/core/src/com/ibm/icu/text/RelativeDateTimeFormatter.java
@@ -252,15 +252,13 @@
/**
* Hour
- * @draft ICU 65
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 65
*/
HOUR,
/**
* Minute
- * @draft ICU 65
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 65
*/
MINUTE,
}
diff --git a/icu4j/main/classes/core/src/com/ibm/icu/util/LocaleMatcher.java b/icu4j/main/classes/core/src/com/ibm/icu/util/LocaleMatcher.java
index dca49ef..114e9ad 100644
--- a/icu4j/main/classes/core/src/com/ibm/icu/util/LocaleMatcher.java
+++ b/icu4j/main/classes/core/src/com/ibm/icu/util/LocaleMatcher.java
@@ -88,23 +88,20 @@
* Builder option for whether the language subtag or the script subtag is most important.
*
* @see LocaleMatcher.Builder#setFavorSubtag(LocaleMatcher.FavorSubtag)
- * @draft ICU 65
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 65
*/
public enum FavorSubtag {
/**
* Language differences are most important, then script differences, then region differences.
* (This is the default behavior.)
*
- * @draft ICU 65
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 65
*/
LANGUAGE,
/**
* Makes script differences matter relatively more than language differences.
*
- * @draft ICU 65
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 65
*/
SCRIPT
}
@@ -114,15 +111,13 @@
* earlier ones are preferred.
*
* @see LocaleMatcher.Builder#setDemotionPerDesiredLocale(LocaleMatcher.Demotion)
- * @draft ICU 65
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 65
*/
public enum Demotion {
/**
* All desired locales are treated equally.
*
- * @draft ICU 65
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 65
*/
NONE,
/**
@@ -149,8 +144,7 @@
* this is possible in future versions of the data.)
* </ul>
*
- * @draft ICU 65
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 65
*/
REGION
}
@@ -194,8 +188,7 @@
/**
* Data for the best-matching pair of a desired and a supported locale.
*
- * @draft ICU 65
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 65
*/
public static final class Result {
private final ULocale desiredULocale;
@@ -221,8 +214,7 @@
* null if the list of desired locales is empty or if none matched well enough.
*
* @return the best-matching desired locale, or null.
- * @draft ICU 65
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 65
*/
public ULocale getDesiredULocale() {
return desiredULocale == null && desiredLocale != null ?
@@ -233,8 +225,7 @@
* null if the list of desired locales is empty or if none matched well enough.
*
* @return the best-matching desired locale, or null.
- * @draft ICU 65
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 65
*/
public Locale getDesiredLocale() {
return desiredLocale == null && desiredULocale != null ?
@@ -248,8 +239,7 @@
* or if the list of supported locales is empty and no explicit default locale is set.
*
* @return the best-matching supported locale, or null.
- * @draft ICU 65
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 65
*/
public ULocale getSupportedULocale() { return supportedULocale; }
/**
@@ -259,8 +249,7 @@
* or if the list of supported locales is empty and no explicit default locale is set.
*
* @return the best-matching supported locale, or null.
- * @draft ICU 65
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 65
*/
public Locale getSupportedLocale() { return supportedLocale; }
@@ -269,8 +258,7 @@
* -1 if the list of desired locales is empty or if none matched well enough.
*
* @return the index of the best-matching desired locale, or -1.
- * @draft ICU 65
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 65
*/
public int getDesiredIndex() { return desiredIndex; }
@@ -282,8 +270,7 @@
* -1 if the list of supported locales is empty or if none matched well enough.
*
* @return the index of the best-matching supported locale, or -1.
- * @draft ICU 65
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 65
*/
public int getSupportedIndex() { return supportedIndex; }
@@ -297,8 +284,7 @@
* <p>Example: desired=ar-SA-u-nu-latn, supported=ar-EG, resolved locale=ar-SA-u-nu-latn
*
* @return a locale combining the best-matching desired and supported locales.
- * @draft ICU 65
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 65
*/
public ULocale makeResolvedULocale() {
ULocale bestDesired = getDesiredULocale();
@@ -343,8 +329,7 @@
* <p>Example: desired=ar-SA-u-nu-latn, supported=ar-EG, resolved locale=ar-SA-u-nu-latn
*
* @return a locale combining the best-matching desired and supported locales.
- * @draft ICU 65
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 65
*/
public Locale makeResolvedLocale() {
ULocale resolved = makeResolvedULocale();
@@ -374,8 +359,7 @@
* LocaleMatcher Builder.
*
* @see LocaleMatcher#builder()
- * @draft ICU 65
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 65
*/
public static final class Builder {
private List<ULocale> supportedLocales;
@@ -397,8 +381,7 @@
*
* @param locales the string of locales to set, to be parsed like LocalePriorityList does
* @return this Builder object
- * @draft ICU 65
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 65
*/
public Builder setSupportedLocales(String locales) {
return setSupportedULocales(LocalePriorityList.add(locales).build().getULocales());
@@ -411,8 +394,7 @@
*
* @param locales the list of locales
* @return this Builder object
- * @draft ICU 65
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 65
*/
public Builder setSupportedULocales(Collection<ULocale> locales) {
supportedLocales = new ArrayList<>(locales);
@@ -426,8 +408,7 @@
*
* @param locales the list of locale
* @return this Builder object
- * @draft ICU 65
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 65
*/
public Builder setSupportedLocales(Collection<Locale> locales) {
supportedLocales = new ArrayList<>(locales.size());
@@ -443,8 +424,7 @@
*
* @param locale another locale
* @return this Builder object
- * @draft ICU 65
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 65
*/
public Builder addSupportedULocale(ULocale locale) {
if (supportedLocales == null) {
@@ -460,8 +440,7 @@
*
* @param locale another locale
* @return this Builder object
- * @draft ICU 65
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 65
*/
public Builder addSupportedLocale(Locale locale) {
return addSupportedULocale(ULocale.forLocale(locale));
@@ -490,8 +469,7 @@
*
* @param defaultLocale the default locale
* @return this Builder object
- * @draft ICU 65
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 65
*/
public Builder setDefaultULocale(ULocale defaultLocale) {
this.defaultLocale = defaultLocale;
@@ -507,8 +485,7 @@
*
* @param defaultLocale the default locale
* @return this Builder object
- * @draft ICU 65
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 65
*/
public Builder setDefaultLocale(Locale defaultLocale) {
this.defaultLocale = ULocale.forLocale(defaultLocale);
@@ -523,8 +500,7 @@
*
* @param subtag the subtag to favor
* @return this Builder object
- * @draft ICU 65
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 65
*/
public Builder setFavorSubtag(FavorSubtag subtag) {
this.favor = subtag;
@@ -537,8 +513,7 @@
*
* @param demotion the demotion per desired locale to set.
* @return this Builder object
- * @draft ICU 65
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 65
*/
public Builder setDemotionPerDesiredLocale(Demotion demotion) {
this.demotion = demotion;
@@ -641,8 +616,7 @@
* This builder can continue to be used.
*
* @return new LocaleMatcher.
- * @draft ICU 65
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 65
*/
public LocaleMatcher build() {
return new LocaleMatcher(this);
@@ -650,8 +624,7 @@
/**
* {@inheritDoc}
- * @draft ICU 65
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 65
*/
@Override
public String toString() {
@@ -679,8 +652,7 @@
* Returns a builder used in chaining parameters for building a LocaleMatcher.
*
* @return a new Builder object
- * @draft ICU 65
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 65
*/
public static Builder builder() {
return new Builder();
@@ -945,8 +917,7 @@
*
* @param desiredLocale Typically a user's language.
* @return the best-matching supported locale.
- * @draft ICU 65
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 65
*/
public Locale getBestLocale(Locale desiredLocale) {
LSR desiredLSR = getMaximalLsrOrUnd(desiredLocale);
@@ -959,8 +930,7 @@
*
* @param desiredLocales Typically a user's languages, in order of preference (descending).
* @return the best-matching supported locale.
- * @draft ICU 65
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 65
*/
public Locale getBestLocale(Iterable<Locale> desiredLocales) {
Iterator<Locale> desiredIter = desiredLocales.iterator();
@@ -1007,8 +977,7 @@
*
* @param desiredLocale Typically a user's language.
* @return the best-matching pair of the desired and a supported locale.
- * @draft ICU 65
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 65
*/
public Result getBestMatchResult(ULocale desiredLocale) {
LSR desiredLSR = getMaximalLsrOrUnd(desiredLocale);
@@ -1021,8 +990,7 @@
*
* @param desiredLocales Typically a user's languages, in order of preference (descending).
* @return the best-matching pair of a desired and a supported locale.
- * @draft ICU 65
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 65
*/
public Result getBestMatchResult(Iterable<ULocale> desiredLocales) {
Iterator<ULocale> desiredIter = desiredLocales.iterator();
@@ -1040,8 +1008,7 @@
*
* @param desiredLocale Typically a user's language.
* @return the best-matching pair of the desired and a supported locale.
- * @draft ICU 65
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 65
*/
public Result getBestLocaleResult(Locale desiredLocale) {
LSR desiredLSR = getMaximalLsrOrUnd(desiredLocale);
@@ -1054,8 +1021,7 @@
*
* @param desiredLocales Typically a user's languages, in order of preference (descending).
* @return the best-matching pair of a desired and a supported locale.
- * @draft ICU 65
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 65
*/
public Result getBestLocaleResult(Iterable<Locale> desiredLocales) {
Iterator<Locale> desiredIter = desiredLocales.iterator();
diff --git a/icu4j/main/classes/core/src/com/ibm/icu/util/LocalePriorityList.java b/icu4j/main/classes/core/src/com/ibm/icu/util/LocalePriorityList.java
index ae1f5e8..555f709 100644
--- a/icu4j/main/classes/core/src/com/ibm/icu/util/LocalePriorityList.java
+++ b/icu4j/main/classes/core/src/com/ibm/icu/util/LocalePriorityList.java
@@ -142,8 +142,7 @@
* The set has the same iteration order as this object itself.
*
* @return the locales
- * @draft ICU 65
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 65
*/
public Set<ULocale> getULocales() {
return languagesAndWeights.keySet();
diff --git a/icu4j/main/classes/core/src/com/ibm/icu/util/TimeZone.java b/icu4j/main/classes/core/src/com/ibm/icu/util/TimeZone.java
index 9a275e5..5300aab 100644
--- a/icu4j/main/classes/core/src/com/ibm/icu/util/TimeZone.java
+++ b/icu4j/main/classes/core/src/com/ibm/icu/util/TimeZone.java
@@ -28,7 +28,6 @@
import com.ibm.icu.text.TimeZoneFormat.TimeType;
import com.ibm.icu.text.TimeZoneNames;
import com.ibm.icu.text.TimeZoneNames.NameType;
-import com.ibm.icu.util.ULocale;
import com.ibm.icu.util.ULocale.Category;
/**
@@ -924,7 +923,9 @@
* @return A <code>TimeZone</code>. Clients are responsible for deleting the
* <code>TimeZone</code> object returned.
* @internal
+ * @deprecated This API is ICU internal only.
*/
+ @Deprecated
public static TimeZone forULocaleOrDefault(ULocale locale) {
String tz = locale.getKeywordValue("timezone");
return (tz == null) ? getDefault() : getTimeZone(tz);
@@ -938,7 +939,9 @@
* @return A <code>TimeZone</code>. Clients are responsible for deleting the
* <code>TimeZone</code> object returned.
* @internal
+ * @deprecated This API is ICU internal only.
*/
+ @Deprecated
public static TimeZone forLocaleOrDefault(Locale locale) {
return forULocaleOrDefault(ULocale.forLocale(locale));
}
diff --git a/icu4j/main/classes/core/src/com/ibm/icu/util/ULocale.java b/icu4j/main/classes/core/src/com/ibm/icu/util/ULocale.java
index 2a3fce3..7c4353e 100644
--- a/icu4j/main/classes/core/src/com/ibm/icu/util/ULocale.java
+++ b/icu4j/main/classes/core/src/com/ibm/icu/util/ULocale.java
@@ -130,16 +130,14 @@
/**
* Types for {@link ULocale#getAvailableLocalesByType}
*
- * @draft ICU 65
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 65
*/
public static enum AvailableType {
/**
* Locales that return data when passed to ICU APIs,
* but not including legacy or alias locales.
*
- * @draft ICU 65
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 65
*/
DEFAULT,
@@ -159,16 +157,14 @@
* DEFAULT. To get both sets at the same time, use
* WITH_LEGACY_ALIASES.
*
- * @draft ICU 65
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 65
*/
ONLY_LEGACY_ALIASES,
/**
* The union of the locales in DEFAULT and ONLY_LEGACY_ALIASES.
*
- * @draft ICU 65
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 65
*/
WITH_LEGACY_ALIASES,
}
@@ -854,8 +850,7 @@
/**
* Returns a list of all installed locales according to the specified type.
*
- * @draft ICU 65
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 65
*/
public static Collection<ULocale> getAvailableLocalesByType(AvailableType type) {
if (type == null) {
@@ -1227,7 +1222,7 @@
this.region = region;
if (!variants.isEmpty()) {
this.variants =
- new ArrayList<String>(Arrays.asList(variants.split("_")));
+ new ArrayList<>(Arrays.asList(variants.split("_")));
}
this.extensions = extensions;
}
@@ -1301,10 +1296,10 @@
if (aliasDataIsLoaded) {
return;
}
- languageAliasMap = new HashMap<String, String>();
- scriptAliasMap = new HashMap<String, String>();
- territoryAliasMap = new HashMap<String, List<String>>();
- variantAliasMap = new HashMap<String, String>();
+ languageAliasMap = new HashMap<>();
+ scriptAliasMap = new HashMap<>();
+ territoryAliasMap = new HashMap<>();
+ variantAliasMap = new HashMap<>();
UResourceBundle metadata = UResourceBundle.getBundleInstance(
ICUData.ICU_BASE_NAME, "metadata",
@@ -1349,7 +1344,7 @@
"Incorrect key [" + aliasFrom + "] in alias:territory.");
}
territoryAliasMap.put(aliasFrom,
- new ArrayList<String>(Arrays.asList(aliasTo.split(" "))));
+ new ArrayList<>(Arrays.asList(aliasTo.split(" "))));
}
for (int i = 0 ; i < variantAlias.getSize(); i++) {
UResourceBundle res = variantAlias.get(i);
@@ -1673,7 +1668,7 @@
"uk_UA", "ur", "ur_PK", "uz", "uz_UZ", "vi", "vi_VN", "yue", "yue_Hant",
"yue_Hant_HK", "yue_HK", "zh", "zh_CN", "zh_Hans", "zh_Hans_CN", "zh_Hant",
"zh_Hant_TW", "zh_TW", "zu", "zu_ZA");
- gKnownCanonicalizedCases = new HashSet<String>(items);
+ gKnownCanonicalizedCases = new HashSet<>(items);
}
return gKnownCanonicalizedCases.contains(name);