]> granicus.if.org Git - icu/commitdiff
ICU-12716 Fixes to remove ReferenceEquality warnings on compile
authorCraig Cornelius <ccornelius@google.com>
Wed, 28 Sep 2016 00:39:19 +0000 (00:39 +0000)
committerCraig Cornelius <ccornelius@google.com>
Wed, 28 Sep 2016 00:39:19 +0000 (00:39 +0000)
X-SVN-Rev: 39371

icu4j/main/classes/core/src/com/ibm/icu/impl/TimeZoneNamesImpl.java
icu4j/main/classes/core/src/com/ibm/icu/impl/UnicodeSetStringSpan.java
icu4j/main/classes/core/src/com/ibm/icu/text/CurrencyMetaInfo.java
icu4j/main/classes/core/src/com/ibm/icu/text/UnicodeSet.java

index afc57d0fa218ddd2800a143ec32946faee75ae54..10cc8c264c357b387e28a949ee1750cdc500166a 100644 (file)
@@ -655,7 +655,7 @@ public class TimeZoneNamesImpl extends TimeZoneNames {
         }
 
         private String[] getNames() {
-            if (names == null) {
+            if (Utility.sameObjects(names, null)) {
                 return null;
             }
             int length = 0;
index cbf2ce59e0ed3f79ab758956a4f1d36ef9fc0df7..b18eef09814c7d36c3ece4b1c6f4a219d9f300b6 100644 (file)
@@ -214,7 +214,7 @@ public class UnicodeSetStringSpan {
         maxLength16 = otherStringSpan.maxLength16;
         someRelevant = otherStringSpan.someRelevant;
         all = true;
-        if (otherStringSpan.spanNotSet == otherStringSpan.spanSet) {
+        if (Utility.sameObjects(otherStringSpan.spanNotSet, otherStringSpan.spanSet)) {
             spanNotSet = spanSet;
         } else {
             spanNotSet = (UnicodeSet) otherStringSpan.spanNotSet.clone();
@@ -226,7 +226,7 @@ public class UnicodeSetStringSpan {
 
     /**
      * Do the strings need to be checked in span() etc.?
-     * 
+     *
      * @return true if strings need to be checked (call span() here),
      *         false if not (use a BMPSet for best performance).
      */
@@ -244,7 +244,7 @@ public class UnicodeSetStringSpan {
      * so that a character span ends before any string.
      */
     private void addToSpanNotSet(int c) {
-        if (spanNotSet == null || spanNotSet == spanSet) {
+        if (Utility.sameObjects(spanNotSet, null) || Utility.sameObjects(spanNotSet, spanSet)) {
             if (spanSet.contains(c)) {
                 return; // Nothing to do.
             }
@@ -269,7 +269,7 @@ public class UnicodeSetStringSpan {
 
     /*
      * Algorithm for span(SpanCondition.CONTAINED)
-     * 
+     *
      * Theoretical algorithm:
      * - Iterate through the string, and at each code point boundary:
      *   + If the code point there is in the set, then remember to continue after it.
@@ -322,7 +322,7 @@ public class UnicodeSetStringSpan {
 
     /*
      * Algorithm for span(SIMPLE)
-     * 
+     *
      * Theoretical algorithm:
      * - Iterate through the string, and at each code point boundary:
      *   + If the code point there is in the set, then remember to continue after it.
@@ -358,7 +358,7 @@ public class UnicodeSetStringSpan {
      */
     /**
      * Spans a string.
-     * 
+     *
      * @param s The string to be spanned
      * @param start The start index that the span begins
      * @param spanCondition The span condition
@@ -637,7 +637,7 @@ public class UnicodeSetStringSpan {
 
     /**
      * Span a string backwards.
-     * 
+     *
      * @param s The string to be spanned
      * @param spanCondition The span condition
      * @return The string index which starts the span (i.e. inclusive).
@@ -806,7 +806,7 @@ public class UnicodeSetStringSpan {
 
     /**
      * Algorithm for spanNot()==span(SpanCondition.NOT_CONTAINED)
-     * 
+     *
      * Theoretical algorithm:
      * - Iterate through the string, and at each code point boundary:
      *   + If the code point there is in the set, then return with the current position.
index 19be546efeea8d3a7f90c9b5777bc9f3657c656f..439e9f9b9c148aa90cd5438941a672d7659697bf 100644 (file)
@@ -320,7 +320,7 @@ public class CurrencyMetaInfo {
          * @stable ICU 4.4
          */
         public boolean equals(CurrencyFilter rhs) {
-            return this == rhs || (rhs != null &&
+          return Utility.sameObjects(this, rhs) || (rhs != null &&
                     equals(this.region, rhs.region) &&
                     equals(this.currency, rhs.currency) &&
                     this.from == rhs.from &&
index 1d844ce657703ad447e28decd3ee776852fcc62f..38510c39899abd113868bc958f778e0d4fdd18d4 100644 (file)
@@ -3232,7 +3232,7 @@ public class UnicodeSet extends UnicodeFilter implements Iterable<String>, Compa
             VersionInfo v = UCharacter.getAge(ch);
             // Reference comparison ok; VersionInfo caches and reuses
             // unique objects.
-            return v != NO_VERSION &&
+            return !Utility.sameObjects(v, NO_VERSION) &&
                     v.compareTo(version) <= 0;
         }
     }