ICU-9101 Fixed some coding issues reported by FindBugs in the new collation code.
X-SVN-Rev: 35322
This commit is contained in:
parent
246f3a9162
commit
aaf4a4d807
@ -839,7 +839,7 @@ public final class CollationBuilder extends CollationRuleParser.Sink {
|
||||
for(;;) {
|
||||
String str = stringIter.next();
|
||||
if(str == null) { break; }
|
||||
if(ignoreString(str) || str == nfdString) { continue; }
|
||||
if(ignoreString(str) || str.contentEquals(nfdString)) { continue; }
|
||||
ce32 = addIfDifferent(prefix, str, newCEs, newCEsLength, ce32);
|
||||
}
|
||||
} else {
|
||||
@ -849,11 +849,11 @@ public final class CollationBuilder extends CollationRuleParser.Sink {
|
||||
String prefix = prefixIter.next();
|
||||
if(prefix == null) { break; }
|
||||
if(ignorePrefix(prefix)) { continue; }
|
||||
boolean samePrefix = prefix == nfdPrefix;
|
||||
boolean samePrefix = prefix.contentEquals(nfdPrefix);
|
||||
for(;;) {
|
||||
String str = stringIter.next();
|
||||
if(str == null) { break; }
|
||||
if(ignoreString(str) || (samePrefix && str == nfdString)) { continue; }
|
||||
if(ignoreString(str) || (samePrefix && str.contentEquals(nfdString))) { continue; }
|
||||
ce32 = addIfDifferent(prefix, str, newCEs, newCEsLength, ce32);
|
||||
}
|
||||
stringIter.reset();
|
||||
|
@ -201,6 +201,7 @@ public abstract class CollationIterator {
|
||||
// Assume that the caller compares the data.
|
||||
// Ignore skipped since that should be unused between calls to nextCE().
|
||||
// (It only stays around to avoid another memory allocation.)
|
||||
if(other == null) { return false; }
|
||||
if(!this.getClass().equals(other.getClass())) { return false; }
|
||||
CollationIterator o = (CollationIterator)other;
|
||||
if(!(ceBuffer.length == o.ceBuffer.length &&
|
||||
|
@ -101,6 +101,7 @@ public final class CollationSettings extends SharedObject {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
if(other == null) { return false; }
|
||||
if(!this.getClass().equals(other.getClass())) { return false; }
|
||||
CollationSettings o = (CollationSettings)other;
|
||||
if(options != o.options) { return false; }
|
||||
|
@ -50,6 +50,12 @@ public final class FCDUTF16CollationIterator extends UTF16CollationIterator {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
assert false : "hashCode not designed";
|
||||
return 42; // any arbitrary constant will do
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetToOffset(int newOffset) {
|
||||
reset();
|
||||
|
@ -40,6 +40,12 @@ public class UTF16CollationIterator extends CollationIterator {
|
||||
return (pos - start) == (o.pos - o.start);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
assert false : "hashCode not designed";
|
||||
return 42; // any arbitrary constant will do
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetToOffset(int newOffset) {
|
||||
reset();
|
||||
|
Loading…
Reference in New Issue
Block a user