Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2883f7ab authored by Roman Kalukiewicz's avatar Roman Kalukiewicz
Browse files

Add @Nullable annotation to the parameter of Object.equals() methods.

Those annotations could be inferred by some tools (like Kotlin), but the
https://checkerframework.org/ doesn't check inherited annotations
complaining about all equals() invocations that get nullable argument.

The change was generated by running

find . -name \*.java | xargs sed -i 's/public boolean equals(Object /public boolean equals(@Nullable Object /'

in the frameworks/base directory and by automatically adding and
formatting required imports if needed. No manual edits.

Bug: 170883422
Test: Annotation change only. Should have not impact.
Exempt-From-Owner-Approval: Mechanical change not specific to any component.
Change-Id: I5eedb571c9d78862115dfdc5dae1cf2a35343580
parent fd026443
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -16,6 +16,7 @@


package android.bluetooth;
package android.bluetooth;


import android.annotation.Nullable;
import android.os.Parcel;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable;


@@ -39,7 +40,7 @@ public final class BluetoothAudioConfig implements Parcelable {
    }
    }


    @Override
    @Override
    public boolean equals(Object o) {
    public boolean equals(@Nullable Object o) {
        if (o instanceof BluetoothAudioConfig) {
        if (o instanceof BluetoothAudioConfig) {
            BluetoothAudioConfig bac = (BluetoothAudioConfig) o;
            BluetoothAudioConfig bac = (BluetoothAudioConfig) o;
            return (bac.mSampleRate == mSampleRate && bac.mChannelConfig == mChannelConfig
            return (bac.mSampleRate == mSampleRate && bac.mChannelConfig == mChannelConfig
+2 −1
Original line number Original line Diff line number Diff line
@@ -16,6 +16,7 @@


package android.bluetooth;
package android.bluetooth;


import android.annotation.Nullable;
import android.annotation.TestApi;
import android.annotation.TestApi;
import android.compat.annotation.UnsupportedAppUsage;
import android.compat.annotation.UnsupportedAppUsage;
import android.os.Build;
import android.os.Build;
@@ -72,7 +73,7 @@ public final class BluetoothClass implements Parcelable {
    }
    }


    @Override
    @Override
    public boolean equals(Object o) {
    public boolean equals(@Nullable Object o) {
        if (o instanceof BluetoothClass) {
        if (o instanceof BluetoothClass) {
            return mClass == ((BluetoothClass) o).mClass;
            return mClass == ((BluetoothClass) o).mClass;
        }
        }
+2 −1
Original line number Original line Diff line number Diff line
@@ -18,6 +18,7 @@ package android.bluetooth;


import android.annotation.IntDef;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.compat.annotation.UnsupportedAppUsage;
import android.compat.annotation.UnsupportedAppUsage;
import android.os.Parcel;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable;
@@ -208,7 +209,7 @@ public final class BluetoothCodecConfig implements Parcelable {
    }
    }


    @Override
    @Override
    public boolean equals(Object o) {
    public boolean equals(@Nullable Object o) {
        if (o instanceof BluetoothCodecConfig) {
        if (o instanceof BluetoothCodecConfig) {
            BluetoothCodecConfig other = (BluetoothCodecConfig) o;
            BluetoothCodecConfig other = (BluetoothCodecConfig) o;
            return (other.mCodecType == mCodecType
            return (other.mCodecType == mCodecType
+1 −1
Original line number Original line Diff line number Diff line
@@ -56,7 +56,7 @@ public final class BluetoothCodecStatus implements Parcelable {
    }
    }


    @Override
    @Override
    public boolean equals(Object o) {
    public boolean equals(@Nullable Object o) {
        if (o instanceof BluetoothCodecStatus) {
        if (o instanceof BluetoothCodecStatus) {
            BluetoothCodecStatus other = (BluetoothCodecStatus) o;
            BluetoothCodecStatus other = (BluetoothCodecStatus) o;
            return (Objects.equals(other.mCodecConfig, mCodecConfig)
            return (Objects.equals(other.mCodecConfig, mCodecConfig)
+1 −1
Original line number Original line Diff line number Diff line
@@ -974,7 +974,7 @@ public final class BluetoothDevice implements Parcelable {
    }
    }


    @Override
    @Override
    public boolean equals(Object o) {
    public boolean equals(@Nullable Object o) {
        if (o instanceof BluetoothDevice) {
        if (o instanceof BluetoothDevice) {
            return mAddress.equals(((BluetoothDevice) o).getAddress());
            return mAddress.equals(((BluetoothDevice) o).getAddress());
        }
        }
Loading