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 @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 return mPackage.equals(other.mPackage)
// never be null. && mClass.equals(other.mClass);
return mPackage.equals(other.mPackage) } else {
&& mClass.equals(other.mClass); return false;
}
} catch (ClassCastException e) {
} }
return false;
} }
@Override @Override