ICU-13177 Fixed a build problem (Java 7 java.util.Objects dependencies) a couple of classes.

X-SVN-Rev: 40501
This commit is contained in:
Yoshito Umaoka 2017-09-28 21:11:51 +00:00
parent 87cd415960
commit 9c871737d8
2 changed files with 19 additions and 20 deletions

View File

@ -2,8 +2,7 @@
// License & terms of use: http://www.unicode.org/copyright.html#License
package com.ibm.icu.impl.number;
import java.util.Objects;
import com.ibm.icu.impl.Utility;
import com.ibm.icu.number.Grouper;
import com.ibm.icu.number.IntegerWidth;
import com.ibm.icu.number.Notation;
@ -56,7 +55,7 @@ public class MacroProps implements Cloneable {
@Override
public int hashCode() {
return Objects.hash(
return Utility.hash(
notation,
unit,
rounder,
@ -76,20 +75,20 @@ public class MacroProps implements Cloneable {
@Override
public boolean equals(Object _other) {
MacroProps other = (MacroProps) _other;
return Objects.equals(notation, other.notation)
&& Objects.equals(unit, other.unit)
&& Objects.equals(rounder, other.rounder)
&& Objects.equals(grouper, other.grouper)
&& Objects.equals(padder, other.padder)
&& Objects.equals(integerWidth, other.integerWidth)
&& Objects.equals(symbols, other.symbols)
&& Objects.equals(unitWidth, other.unitWidth)
&& Objects.equals(sign, other.sign)
&& Objects.equals(decimal, other.decimal)
&& Objects.equals(affixProvider, other.affixProvider)
&& Objects.equals(multiplier, other.multiplier)
&& Objects.equals(rules, other.rules)
&& Objects.equals(loc, other.loc);
return Utility.equals(notation, other.notation)
&& Utility.equals(unit, other.unit)
&& Utility.equals(rounder, other.rounder)
&& Utility.equals(grouper, other.grouper)
&& Utility.equals(padder, other.padder)
&& Utility.equals(integerWidth, other.integerWidth)
&& Utility.equals(symbols, other.symbols)
&& Utility.equals(unitWidth, other.unitWidth)
&& Utility.equals(sign, other.sign)
&& Utility.equals(decimal, other.decimal)
&& Utility.equals(affixProvider, other.affixProvider)
&& Utility.equals(multiplier, other.multiplier)
&& Utility.equals(rules, other.rules)
&& Utility.equals(loc, other.loc);
}
@Override

View File

@ -3,9 +3,9 @@
package com.ibm.icu.number;
import java.math.BigInteger;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicLongFieldUpdater;
import com.ibm.icu.impl.Utility;
import com.ibm.icu.impl.number.DecimalQuantity;
import com.ibm.icu.impl.number.DecimalQuantity_DualStorageBCD;
import com.ibm.icu.impl.number.MacroProps;
@ -101,13 +101,13 @@ public class LocalizedNumberFormatter extends NumberFormatterSettings<LocalizedN
MeasureUnit unit = input.getUnit();
Number number = input.getNumber();
// Use this formatter if possible
if (Objects.equals(resolve().unit, unit)) {
if (Utility.equals(resolve().unit, unit)) {
return format(number);
}
// This mechanism saves the previously used unit, so if the user calls this method with the
// same unit multiple times in a row, they get a more efficient code path.
LocalizedNumberFormatter withUnit = savedWithUnit;
if (withUnit == null || !Objects.equals(withUnit.resolve().unit, unit)) {
if (withUnit == null || !Utility.equals(withUnit.resolve().unit, unit)) {
withUnit = new LocalizedNumberFormatter(this, KEY_UNIT, unit);
savedWithUnit = withUnit;
}