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

Commit 24403f7e 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 a4091c69
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -4901,7 +4901,7 @@ package android.app {
  @Deprecated public class Fragment implements android.content.ComponentCallbacks2 android.view.View.OnCreateContextMenuListener {
    ctor @Deprecated public Fragment();
    method @Deprecated public void dump(String, java.io.FileDescriptor, java.io.PrintWriter, String[]);
    method @Deprecated public final boolean equals(Object);
    method @Deprecated public final boolean equals(@Nullable Object);
    method @Deprecated public final android.app.Activity getActivity();
    method @Deprecated public boolean getAllowEnterTransitionOverlap();
    method @Deprecated public boolean getAllowReturnTransitionOverlap();
+1 −1
Original line number Diff line number Diff line
@@ -1077,7 +1077,7 @@ public class AccessibilityServiceInfo implements Parcelable {
    }

    @Override
    public boolean equals(Object obj) {
    public boolean equals(@Nullable Object obj) {
        if (this == obj) {
            return true;
        }
+1 −1
Original line number Diff line number Diff line
@@ -287,7 +287,7 @@ public final class AccessibilityShortcutInfo {
     * {@inheritDoc}
     */
    @Override
    public boolean equals(Object obj) {
    public boolean equals(@Nullable Object obj) {
        if (this == obj) {
            return true;
        }
+1 −1
Original line number Diff line number Diff line
@@ -50,7 +50,7 @@ public class Account implements Parcelable {
    @UnsupportedAppUsage
    private final @Nullable String accessId;

    public boolean equals(Object o) {
    public boolean equals(@Nullable Object o) {
        if (o == this) return true;
        if (!(o instanceof Account)) return false;
        final Account other = (Account)o;
+2 −1
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.accounts;

import android.annotation.Nullable;
import android.compat.annotation.UnsupportedAppUsage;

/**
@@ -35,7 +36,7 @@ public class AccountAndUser {
        this.userId = userId;
    }

    public boolean equals(Object o) {
    public boolean equals(@Nullable Object o) {
        if (this == o) return true;
        if (!(o instanceof AccountAndUser)) return false;
        final AccountAndUser other = (AccountAndUser) o;
Loading