Merge "Add @Nullable to Object#equals()"

This commit is contained in:
Treehugger Robot
2021-02-05 09:36:41 +00:00
committed by Gerrit Code Review
24 changed files with 35 additions and 25 deletions

View File

@@ -16,6 +16,7 @@
package android.net;
import android.annotation.Nullable;
import android.net.NetworkTemplate;
import android.os.Parcel;
import android.os.Parcelable;
@@ -95,7 +96,7 @@ public final class DataUsageRequest implements Parcelable {
}
@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
if (obj instanceof DataUsageRequest == false) return false;
DataUsageRequest that = (DataUsageRequest) obj;
return that.requestId == this.requestId

View File

@@ -160,7 +160,7 @@ public final class DhcpResults implements Parcelable {
}
@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
if (this == obj) return true;
if (!(obj instanceof DhcpResults)) return false;

View File

@@ -360,7 +360,7 @@ public final class Ikev2VpnProfile extends PlatformVpnProfile {
}
@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
if (!(obj instanceof Ikev2VpnProfile)) {
return false;
}

View File

@@ -19,6 +19,7 @@ import static android.net.IpSecManager.INVALID_RESOURCE_ID;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.RequiresFeature;
import android.annotation.RequiresPermission;
import android.annotation.SystemApi;
@@ -150,7 +151,7 @@ public final class IpSecTransform implements AutoCloseable {
/**
* Standard equals.
*/
public boolean equals(Object other) {
public boolean equals(@Nullable Object other) {
if (this == other) return true;
if (!(other instanceof IpSecTransform)) return false;
final IpSecTransform rhs = (IpSecTransform) other;

View File

@@ -17,6 +17,7 @@
package android.net;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.os.Parcel;
import android.os.Parcelable;
@@ -44,7 +45,7 @@ public final class MatchAllNetworkSpecifier extends NetworkSpecifier implements
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
return o instanceof MatchAllNetworkSpecifier;
}

View File

@@ -18,6 +18,7 @@ package android.net;
import static android.net.ConnectivityManager.TYPE_WIFI;
import android.annotation.Nullable;
import android.content.Context;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
@@ -67,7 +68,7 @@ public class NetworkIdentity implements Comparable<NetworkIdentity> {
}
@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
if (obj instanceof NetworkIdentity) {
final NetworkIdentity ident = (NetworkIdentity) obj;
return mType == ident.mType && mSubType == ident.mSubType && mRoaming == ident.mRoaming

View File

@@ -16,6 +16,7 @@
package android.net;
import android.annotation.Nullable;
import android.compat.annotation.UnsupportedAppUsage;
import android.os.Parcel;
import android.os.Parcelable;
@@ -205,7 +206,7 @@ public class NetworkPolicy implements Parcelable, Comparable<NetworkPolicy> {
}
@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
if (obj instanceof NetworkPolicy) {
final NetworkPolicy other = (NetworkPolicy) obj;
return warningBytes == other.warningBytes

View File

@@ -110,7 +110,7 @@ public final class NetworkScorerAppData implements Parcelable {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
NetworkScorerAppData that = (NetworkScorerAppData) o;

View File

@@ -412,7 +412,7 @@ public final class NetworkStats implements Parcelable {
/** @hide */
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (o instanceof Entry) {
final Entry e = (Entry) o;
return uid == e.uid && set == e.set && tag == e.tag && metered == e.metered

View File

@@ -329,7 +329,7 @@ public class NetworkTemplate implements Parcelable {
}
@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
if (obj instanceof NetworkTemplate) {
final NetworkTemplate other = (NetworkTemplate) obj;
return mMatchRule == other.mMatchRule

View File

@@ -17,6 +17,7 @@
package android.net;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;
@@ -45,7 +46,7 @@ public final class StringNetworkSpecifier extends NetworkSpecifier implements Pa
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (!(o instanceof StringNetworkSpecifier)) return false;
return TextUtils.equals(specifier, ((StringNetworkSpecifier) o).specifier);
}

View File

@@ -17,6 +17,7 @@
package android.net;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.os.Parcel;
import android.os.Parcelable;
@@ -74,7 +75,7 @@ public final class TelephonyNetworkSpecifier extends NetworkSpecifier implements
}
@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
if (this == obj) {
return true;
}

View File

@@ -18,6 +18,7 @@ package android.net;
import static android.os.UserHandle.PER_USER_RANGE;
import android.annotation.Nullable;
import android.os.Parcel;
import android.os.Parcelable;
@@ -81,7 +82,7 @@ public final class UidRange implements Parcelable {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}

View File

@@ -343,7 +343,7 @@ public abstract class Uri implements Parcelable, Comparable<Uri> {
* default port explicitly and the other leaves it implicit, they will not
* be considered equal.
*/
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (!(o instanceof Uri)) {
return false;
}

View File

@@ -276,7 +276,7 @@ public final class CaptivePortalData implements Parcelable {
}
@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
if (!(obj instanceof CaptivePortalData)) return false;
final CaptivePortalData other = (CaptivePortalData) obj;
return mRefreshTimeMillis == other.mRefreshTimeMillis

View File

@@ -167,7 +167,7 @@ public final class IpConfiguration implements Parcelable {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (o == this) {
return true;
}

View File

@@ -18,6 +18,7 @@ package android.net;
import android.annotation.IntRange;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.os.Parcel;
import android.os.Parcelable;
@@ -124,7 +125,7 @@ public final class IpPrefix implements Parcelable {
* @return {@code true} if both objects are equal, {@code false} otherwise.
*/
@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
if (!(obj instanceof IpPrefix)) {
return false;
}

View File

@@ -349,7 +349,7 @@ public class LinkAddress implements Parcelable {
* @return {@code true} if both objects are equal, {@code false} otherwise.
*/
@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
if (!(obj instanceof LinkAddress)) {
return false;
}

View File

@@ -1613,7 +1613,7 @@ public final class LinkProperties implements Parcelable {
* @return {@code true} if both objects are equal, {@code false} otherwise.
*/
@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
if (this == obj) return true;
if (!(obj instanceof LinkProperties)) return false;

View File

@@ -161,7 +161,7 @@ public final class MacAddress implements Parcelable {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
return (o instanceof MacAddress) && ((MacAddress) o).mAddr == mAddr;
}

View File

@@ -17,6 +17,7 @@
package android.net;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.compat.annotation.UnsupportedAppUsage;
import android.os.Build;
@@ -510,7 +511,7 @@ public class Network implements Parcelable {
};
@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
if (!(obj instanceof Network)) return false;
Network other = (Network)obj;
return this.netId == other.netId;

View File

@@ -567,7 +567,7 @@ public class NetworkRequest implements Parcelable {
proto.end(token);
}
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
if (obj instanceof NetworkRequest == false) return false;
NetworkRequest that = (NetworkRequest)obj;
return (that.legacyType == this.legacyType &&

View File

@@ -275,7 +275,7 @@ public class ProxyInfo implements Parcelable {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (!(o instanceof ProxyInfo)) return false;
ProxyInfo p = (ProxyInfo)o;
// If PAC URL is present in either then they must be equal.

View File

@@ -534,7 +534,7 @@ public final class RouteInfo implements Parcelable {
* Compares this RouteInfo object against the specified object and indicates if they are equal.
* @return {@code true} if the objects are equal, {@code false} otherwise.
*/
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
if (this == obj) return true;
if (!(obj instanceof RouteInfo)) return false;
@@ -570,7 +570,7 @@ public final class RouteInfo implements Parcelable {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (!(o instanceof RouteKey)) {
return false;
}