Committed by
Gerrit Code Review
Changing equals in IntentUtils to return false if
intents are different classes. This replaces the behavior where we throw a runtime exception. Change-Id: I063621b683af186611b18f87c24e852e80c31977
Showing
1 changed file
with
3 additions
and
4 deletions
| ... | @@ -25,8 +25,6 @@ import org.slf4j.LoggerFactory; | ... | @@ -25,8 +25,6 @@ import org.slf4j.LoggerFactory; |
| 25 | 25 | ||
| 26 | import java.util.Objects; | 26 | import java.util.Objects; |
| 27 | 27 | ||
| 28 | -import static com.google.common.base.Preconditions.checkArgument; | ||
| 29 | - | ||
| 30 | /** | 28 | /** |
| 31 | * Utilities for dealing with intents. | 29 | * Utilities for dealing with intents. |
| 32 | */ | 30 | */ |
| ... | @@ -50,8 +48,9 @@ public final class IntentUtils { | ... | @@ -50,8 +48,9 @@ public final class IntentUtils { |
| 50 | * @return true if the two intents represent the same value, otherwise false | 48 | * @return true if the two intents represent the same value, otherwise false |
| 51 | */ | 49 | */ |
| 52 | public static boolean equals(Intent one, Intent two) { | 50 | public static boolean equals(Intent one, Intent two) { |
| 53 | - checkArgument(one.getClass() == two.getClass(), | 51 | + if (one.getClass() != two.getClass()) { |
| 54 | - "Intents are not the same type"); | 52 | + return false; |
| 53 | + } | ||
| 55 | 54 | ||
| 56 | if (!(Objects.equals(one.appId(), two.appId()) && | 55 | if (!(Objects.equals(one.appId(), two.appId()) && |
| 57 | Objects.equals(one.key(), two.key()))) { | 56 | Objects.equals(one.key(), two.key()))) { | ... | ... |
-
Please register or login to post a comment