Fix errorprone warnings
https://errorprone.info/bugpattern/BadInstanceof https://errorprone.info/bugpattern/CompareToZero Bug: 253827323 Test: Presubmits Flag: EXEMPT refactor Change-Id: If28f8f7f407b5b1e58911c58bb7d1b80f08c6114
This commit is contained in:
1 parent
e239718b4e
commit
42fc2058e6
3 files changed
+13
-13
No files matched your search
@@ -127,17 +127,17 @@ public class StringMatcherUtility {
|
||||
if (query == null || target == null) {
|
||||
return false;
|
||||
}
|
||||
switch (mCollator.compare(query, target)) {
|
||||
case 0:
|
||||
return true;
|
||||
case -1:
|
||||
// The target string can contain a modifier which would make it larger than
|
||||
// the query string (even though the length is same). If the query becomes
|
||||
// larger after appending a unicode character, it was originally a prefix of
|
||||
// the target string and hence should match.
|
||||
return mCollator.compare(query + MAX_UNICODE, target) > -1;
|
||||
default:
|
||||
return false;
|
||||
int compare = mCollator.compare(query, target);
|
||||
if (compare == 0) {
|
||||
return true;
|
||||
} else if (compare < 0) {
|
||||
// The target string can contain a modifier which would make it larger than
|
||||
// the query string (even though the length is same). If the query becomes
|
||||
// larger after appending a unicode character, it was originally a prefix of
|
||||
// the target string and hence should match.
|
||||
return mCollator.compare(query + MAX_UNICODE, target) >= 0;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user