Improve change comments in java.time.format
Improve Android-changed/-removed/-added comments in
DateTimeFormatterBuilder, DateTimeTextProvider and ZoneName.
Bug: 35910877
Test: m (comment-only changes)
Change-Id: I036856df20a151096c6ddcb876c28b1e3ead2a2c
diff --git a/ojluni/src/main/java/java/time/format/DateTimeFormatterBuilder.java b/ojluni/src/main/java/java/time/format/DateTimeFormatterBuilder.java
index f9cff0a..69e35d6 100644
--- a/ojluni/src/main/java/java/time/format/DateTimeFormatterBuilder.java
+++ b/ojluni/src/main/java/java/time/format/DateTimeFormatterBuilder.java
@@ -3641,7 +3641,7 @@
private static final int DST = 1;
private static final int GENERIC = 2;
- // Android-changed: List of types used by getDisplayName().
+ // BEGIN Android-added: Lists of types used by getDisplayName().
private static final TimeZoneNames.NameType[] TYPES = new TimeZoneNames.NameType[] {
TimeZoneNames.NameType.LONG_STANDARD,
TimeZoneNames.NameType.SHORT_STANDARD,
@@ -3662,6 +3662,7 @@
TimeZoneNames.NameType.SHORT_DAYLIGHT,
TimeZoneNames.NameType.SHORT_GENERIC,
};
+ // END Android-added: Lists of types used by getDisplayName().
private static final Map<String, SoftReference<Map<Locale, String[]>>> cache =
new ConcurrentHashMap<>();
@@ -3675,7 +3676,7 @@
Map<Locale, String[]> perLocale = null;
if (ref == null || (perLocale = ref.get()) == null ||
(names = perLocale.get(locale)) == null) {
- // Android-changed: use ICU TimeZoneNames instead of TimeZoneNameUtility.
+ // BEGIN Android-changed: use ICU TimeZoneNames instead of TimeZoneNameUtility.
TimeZoneNames timeZoneNames = TimeZoneNames.getInstance(locale);
names = new String[TYPES.length + 1];
// Zeroth index used for id, other indexes based on NameType constant + 1.
@@ -3703,6 +3704,7 @@
if (names[5] == null) {
names[5] = names[0]; // use the id
}
+ // END Android-changed: use ICU TimeZoneNames instead of TimeZoneNameUtility.
if (names[6] == null) {
names[6] = names[0];
}
@@ -3763,12 +3765,12 @@
isCaseSensitive ? cachedTree : cachedTreeCI;
Entry<Integer, SoftReference<PrefixTree>> entry;
+ // BEGIN Android-changed: use ICU TimeZoneNames to get Zone names.
PrefixTree tree;
if ((entry = cached.get(locale)) == null ||
(entry.getKey() != regionIdsSize ||
(tree = entry.getValue().get()) == null)) {
tree = PrefixTree.newTree(context);
- // Android-changed: use ICU TimeZoneNames to get Zone names.
TimeZoneNames timeZoneNames = TimeZoneNames.getInstance(locale);
long now = System.currentTimeMillis();
TimeZoneNames.NameType[] types =
@@ -3798,6 +3800,7 @@
tree.add(names[i], zid);
}
}
+ // END Android-changed: use ICU TimeZoneNames to get Zone names.
}
}
cached.put(locale, new SimpleImmutableEntry<>(regionIdsSize, new SoftReference<>(tree)));
@@ -3923,7 +3926,7 @@
return position;
}
- // Android-changed: "GMT0" is considered a valid ZoneId.
+ // Android-added: "GMT0" is considered a valid ZoneId.
if (text.charAt(position) == '0' && prefix.equals("GMT")) {
context.setParsed(ZoneId.of("GMT0"));
return position + 1;
diff --git a/ojluni/src/main/java/java/time/format/DateTimeTextProvider.java b/ojluni/src/main/java/java/time/format/DateTimeTextProvider.java
index 99ab9b0..2ef9df8 100644
--- a/ojluni/src/main/java/java/time/format/DateTimeTextProvider.java
+++ b/ojluni/src/main/java/java/time/format/DateTimeTextProvider.java
@@ -448,6 +448,7 @@
return ""; // null marker for map
}
+ // Android-added: extractQuarters to extract Map of quarter names from ICU resource bundle.
private static Map<Long, String> extractQuarters(ICUResourceBundle rb, String key) {
String[] names = rb.getWithFallback(key).getStringArray();
Map<Long, String> map = new HashMap<>();
@@ -468,7 +469,7 @@
return new SimpleImmutableEntry<>(text, field);
}
- // Android-changed: removed getLocalizedResource.
+ // Android-removed: unused helper method getLocalizedResource.
/**
* Stores the text for a single locale.
diff --git a/ojluni/src/main/java/java/time/format/ZoneName.java b/ojluni/src/main/java/java/time/format/ZoneName.java
index c3eb20a..fe4a95a 100644
--- a/ojluni/src/main/java/java/time/format/ZoneName.java
+++ b/ojluni/src/main/java/java/time/format/ZoneName.java
@@ -38,10 +38,10 @@
* The zid<->metazone mappings are based on CLDR metaZones.xml.
* The alias mappings are based on Link entries in tzdb data files.
*/
-// Android-changed: delegate to ICU.
class ZoneName {
public static String toZid(String zid, Locale locale) {
+ // Android-changed: delegate to ICU.
TimeZoneNames tzNames = TimeZoneNames.getInstance(locale);
if (tzNames.getAvailableMetaZoneIDs().contains(zid)) {
// Compare TimeZoneFormat#getTargetRegion.
@@ -64,4 +64,7 @@
}
return zid;
}
+
+ // Android-removed: zidMap and aliasMap containing zone id data.
+ // Android-removed: zidToMzone, mzoneToZid, mzoneToZidL, aliases and their initialization code.
}