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