From eca52aa12221ac1ee51f3e68f51c0b79012c2b40 Mon Sep 17 00:00:00 2001 From: Shane Carr Date: Tue, 6 Feb 2018 23:38:29 +0000 Subject: [PATCH] ICU-13461 Fixing conditional in Grouper.java (this is J-only code, so an ICU4C fix is not necessary). Clarifying comments in MeasureFormat files. X-SVN-Rev: 40846 --- .../core/src/com/ibm/icu/impl/number/Grouper.java | 4 ++-- .../core/src/com/ibm/icu/text/MeasureFormat.java | 2 +- .../core/src/com/ibm/icu/text/TimeUnitFormat.java | 11 ++--------- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/icu4j/main/classes/core/src/com/ibm/icu/impl/number/Grouper.java b/icu4j/main/classes/core/src/com/ibm/icu/impl/number/Grouper.java index fee5564de60..add6f66563c 100644 --- a/icu4j/main/classes/core/src/com/ibm/icu/impl/number/Grouper.java +++ b/icu4j/main/classes/core/src/com/ibm/icu/impl/number/Grouper.java @@ -63,9 +63,9 @@ public class Grouper { return GROUPER_WESTERN; } else if (grouping1 == 3 && grouping2 == 2 && minGrouping == 1) { return GROUPER_INDIC; - } else if (grouping1 == 3 && grouping2 == 3 && minGrouping == 1) { + } else if (grouping1 == 3 && grouping2 == 3 && minGrouping == 2) { return GROUPER_WESTERN_MIN2; - } else if (grouping1 == 3 && grouping2 == 2 && minGrouping == 1) { + } else if (grouping1 == 3 && grouping2 == 2 && minGrouping == 2) { return GROUPER_INDIC_MIN2; } else { return new Grouper(grouping1, grouping2, minGrouping); diff --git a/icu4j/main/classes/core/src/com/ibm/icu/text/MeasureFormat.java b/icu4j/main/classes/core/src/com/ibm/icu/text/MeasureFormat.java index 834d6c51ec9..0d950cbc0a3 100644 --- a/icu4j/main/classes/core/src/com/ibm/icu/text/MeasureFormat.java +++ b/icu4j/main/classes/core/src/com/ibm/icu/text/MeasureFormat.java @@ -1044,7 +1044,7 @@ public class MeasureFormat extends UFormat { case TIME_UNIT_FORMAT: return createTimeUnitFormat(); case CURRENCY_FORMAT: - return new CurrencyFormat(locale); + return MeasureFormat.getCurrencyFormat(locale); default: throw new InvalidObjectException("Unknown subclass: " + subClass); } diff --git a/icu4j/main/classes/core/src/com/ibm/icu/text/TimeUnitFormat.java b/icu4j/main/classes/core/src/com/ibm/icu/text/TimeUnitFormat.java index f8fff0b15f3..cd0ef2dd6aa 100644 --- a/icu4j/main/classes/core/src/com/ibm/icu/text/TimeUnitFormat.java +++ b/icu4j/main/classes/core/src/com/ibm/icu/text/TimeUnitFormat.java @@ -84,19 +84,12 @@ public class TimeUnitFormat extends MeasureFormat { private static final long serialVersionUID = -3707773153184971529L; - // These fields are supposed to be the same as the fields in mf. They - // are here for serialization backward compatibility and to support parsing. + // Unlike MeasureFormat, this class is mutable and allows a new NumberFormat to be set after + // initialization. Keep a second copy of NumberFormat and use it instead of the one from the parent. private NumberFormat format; private ULocale locale; private int style; - // We use this field in lieu of the super class because the super class - // is immutable while this class is mutable. The contents of the super class - // is an empty shell. Every public method of the super class is overridden to - // delegate to this field. Each time this object mutates, it replaces this field with - // a new immutable instance. -// private transient MeasureFormat mf; - private transient Map> timeUnitToCountToPatterns; private transient PluralRules pluralRules; private transient boolean isReady; -- 2.40.0