Merge "Non-functional simplification of ComponentName.equals"

This commit is contained in:
Santiago Seifert
2022-10-26 11:29:48 +00:00
committed by Gerrit Code Review

View File

@@ -314,18 +314,15 @@ public final class ComponentName implements Parcelable, Cloneable, Comparable<Co
*/ */
@Override @Override
public boolean equals(@Nullable Object obj) { public boolean equals(@Nullable Object obj) {
try { if (obj instanceof ComponentName) {
if (obj != null) { ComponentName other = (ComponentName) obj;
ComponentName other = (ComponentName)obj; // mPackage and mClass can never be null.
// Note: no null checks, because mPackage and mClass can
// never be null.
return mPackage.equals(other.mPackage) return mPackage.equals(other.mPackage)
&& mClass.equals(other.mClass); && mClass.equals(other.mClass);
} } else {
} catch (ClassCastException e) {
}
return false; return false;
} }
}
@Override @Override
public int hashCode() { public int hashCode() {