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

Commit ddb26814 authored by Eugene Susla's avatar Eugene Susla
Browse files

Disregard annotation params for stale dataclass detection

Annotation processor seens annotation args with constants already inlined,
making it challenging to compare to the souce-generated metadata that contains
initial expressions.

For now just ignoring args for all non-DataClass annotations to prevent false positives

Test: . frameworks/base/tests/Codegen/runTest.sh
Exempt-From-Owner-Approval: changing metadata on multiple files
Change-Id: I640816ae0f20f36b1b828bc2161f53788c4a4dae
parent 6ef0203c
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -72,7 +72,7 @@ public final class AsyncNotedAppOp implements Parcelable {



    // Code below generated by codegen v1.0.15.
    // Code below generated by codegen v1.0.20.
    //
    // DO NOT MODIFY!
    // CHECKSTYLE:OFF Generated code
@@ -261,10 +261,10 @@ public final class AsyncNotedAppOp implements Parcelable {
    };

    @DataClass.Generated(
            time = 1583866239013L,
            codegenVersion = "1.0.15",
            time = 1604456255752L,
            codegenVersion = "1.0.20",
            sourceFile = "frameworks/base/core/java/android/app/AsyncNotedAppOp.java",
            inputSignatures = "private final @android.annotation.IntRange(from=0L) int mOpCode\nprivate final @android.annotation.IntRange(from=0L) int mNotingUid\nprivate final @android.annotation.Nullable java.lang.String mAttributionTag\nprivate final @android.annotation.NonNull java.lang.String mMessage\nprivate final @android.annotation.CurrentTimeMillisLong long mTime\npublic @android.annotation.NonNull java.lang.String getOp()\nprivate  void onConstructed()\nclass AsyncNotedAppOp extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genEqualsHashCode=true, genAidl=true, genHiddenConstructor=true)")
            inputSignatures = "private final @android.annotation.IntRange int mOpCode\nprivate final @android.annotation.IntRange int mNotingUid\nprivate final @android.annotation.Nullable java.lang.String mAttributionTag\nprivate final @android.annotation.NonNull java.lang.String mMessage\nprivate final @android.annotation.CurrentTimeMillisLong long mTime\npublic @android.annotation.NonNull java.lang.String getOp()\nprivate  void onConstructed()\nclass AsyncNotedAppOp extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genEqualsHashCode=true, genAidl=true, genHiddenConstructor=true)")
    @Deprecated
    private void __metadata() {}

+42 −19
Original line number Diff line number Diff line
@@ -59,14 +59,18 @@ public class SplitPermissionInfoParcelable implements Parcelable {



    // Code below generated by codegen v1.0.0.
    // Code below generated by codegen v1.0.20.
    //
    // DO NOT MODIFY!
    // CHECKSTYLE:OFF Generated code
    //
    // To regenerate run:
    // $ codegen $ANDROID_BUILD_TOP/frameworks/base/core/java/android/content/pm/permission/SplitPermissionInfoParcelable.java
    //
    // CHECKSTYLE:OFF Generated code
    // To exclude the generated code from IntelliJ auto-formatting enable (one-time):
    //   Settings > Editor > Code Style > Formatter Control
    //@formatter:off


    /**
     * Creates a new SplitPermissionInfoParcelable.
@@ -154,7 +158,7 @@ public class SplitPermissionInfoParcelable implements Parcelable {

    @Override
    @DataClass.Generated.Member
    public void writeToParcel(Parcel dest, int flags) {
    public void writeToParcel(@NonNull Parcel dest, int flags) {
        // You can override field parcelling by defining methods like:
        // void parcelFieldName(Parcel dest, int flags) { ... }

@@ -167,6 +171,32 @@ public class SplitPermissionInfoParcelable implements Parcelable {
    @DataClass.Generated.Member
    public int describeContents() { return 0; }

    /** @hide */
    @SuppressWarnings({"unchecked", "RedundantCast"})
    @DataClass.Generated.Member
    protected SplitPermissionInfoParcelable(@NonNull Parcel in) {
        // You can override field unparcelling by defining methods like:
        // static FieldType unparcelFieldName(Parcel in) { ... }

        String splitPermission = in.readString();
        List<String> newPermissions = new java.util.ArrayList<>();
        in.readStringList(newPermissions);
        int targetSdk = in.readInt();

        this.mSplitPermission = splitPermission;
        com.android.internal.util.AnnotationValidations.validate(
                NonNull.class, null, mSplitPermission);
        this.mNewPermissions = newPermissions;
        com.android.internal.util.AnnotationValidations.validate(
                NonNull.class, null, mNewPermissions);
        this.mTargetSdk = targetSdk;
        com.android.internal.util.AnnotationValidations.validate(
                IntRange.class, null, mTargetSdk,
                "from", 0);

        onConstructed();
    }

    @DataClass.Generated.Member
    public static final @NonNull Parcelable.Creator<SplitPermissionInfoParcelable> CREATOR
            = new Parcelable.Creator<SplitPermissionInfoParcelable>() {
@@ -176,28 +206,21 @@ public class SplitPermissionInfoParcelable implements Parcelable {
        }

        @Override
        @SuppressWarnings({"unchecked", "RedundantCast"})
        public SplitPermissionInfoParcelable createFromParcel(Parcel in) {
            // You can override field unparcelling by defining methods like:
            // static FieldType unparcelFieldName(Parcel in) { ... }

            String splitPermission = in.readString();
            List<String> newPermissions = new java.util.ArrayList<>();
            in.readStringList(newPermissions);
            int targetSdk = in.readInt();
            return new SplitPermissionInfoParcelable(
                    splitPermission,
                    newPermissions,
                    targetSdk);
        public SplitPermissionInfoParcelable createFromParcel(@NonNull Parcel in) {
            return new SplitPermissionInfoParcelable(in);
        }
    };

    @DataClass.Generated(
            time = 1567634390477L,
            codegenVersion = "1.0.0",
            time = 1604456266666L,
            codegenVersion = "1.0.20",
            sourceFile = "frameworks/base/core/java/android/content/pm/permission/SplitPermissionInfoParcelable.java",
            inputSignatures = "private final @android.annotation.NonNull java.lang.String mSplitPermission\nprivate final @android.annotation.NonNull java.util.List<java.lang.String> mNewPermissions\nprivate final @android.annotation.IntRange(from=0L) int mTargetSdk\nprivate  void onConstructed()\nclass SplitPermissionInfoParcelable extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genEqualsHashCode=true)")
            inputSignatures = "private final @android.annotation.NonNull java.lang.String mSplitPermission\nprivate final @android.annotation.NonNull java.util.List<java.lang.String> mNewPermissions\nprivate final @android.annotation.IntRange int mTargetSdk\nprivate  void onConstructed()\nclass SplitPermissionInfoParcelable extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genEqualsHashCode=true)")
    @Deprecated
    private void __metadata() {}


    //@formatter:on
    // End of generated code

}
+4 −4
Original line number Diff line number Diff line
@@ -93,7 +93,7 @@ public final class VirtualDisplayConfig implements Parcelable {



    // Code below generated by codegen v1.0.15.
    // Code below generated by codegen v1.0.20.
    //
    // DO NOT MODIFY!
    // CHECKSTYLE:OFF Generated code
@@ -477,10 +477,10 @@ public final class VirtualDisplayConfig implements Parcelable {
    }

    @DataClass.Generated(
            time = 1585179350902L,
            codegenVersion = "1.0.15",
            time = 1604456298440L,
            codegenVersion = "1.0.20",
            sourceFile = "frameworks/base/core/java/android/hardware/display/VirtualDisplayConfig.java",
            inputSignatures = "private @android.annotation.NonNull java.lang.String mName\nprivate @android.annotation.IntRange(from=1L) int mWidth\nprivate @android.annotation.IntRange(from=1L) int mHeight\nprivate @android.annotation.IntRange(from=1L) int mDensityDpi\nprivate  int mFlags\nprivate @android.annotation.Nullable android.view.Surface mSurface\nprivate @android.annotation.Nullable java.lang.String mUniqueId\nprivate  int mDisplayIdToMirror\nclass VirtualDisplayConfig extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genParcelable=true, genAidl=true, genBuilder=true)")
            inputSignatures = "private @android.annotation.NonNull java.lang.String mName\nprivate @android.annotation.IntRange int mWidth\nprivate @android.annotation.IntRange int mHeight\nprivate @android.annotation.IntRange int mDensityDpi\nprivate  int mFlags\nprivate @android.annotation.Nullable android.view.Surface mSurface\nprivate @android.annotation.Nullable java.lang.String mUniqueId\nprivate  int mDisplayIdToMirror\nclass VirtualDisplayConfig extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genParcelable=true, genAidl=true, genBuilder=true)")
    @Deprecated
    private void __metadata() {}

+4 −4
Original line number Diff line number Diff line
@@ -77,7 +77,7 @@ public final class InlinePresentation implements Parcelable {



    // Code below generated by codegen v1.0.15.
    // Code below generated by codegen v1.0.20.
    //
    // DO NOT MODIFY!
    // CHECKSTYLE:OFF Generated code
@@ -259,10 +259,10 @@ public final class InlinePresentation implements Parcelable {
    };

    @DataClass.Generated(
            time = 1596484869201L,
            codegenVersion = "1.0.15",
            time = 1604456277638L,
            codegenVersion = "1.0.20",
            sourceFile = "frameworks/base/core/java/android/service/autofill/InlinePresentation.java",
            inputSignatures = "private final @android.annotation.NonNull android.app.slice.Slice mSlice\nprivate final @android.annotation.NonNull android.widget.inline.InlinePresentationSpec mInlinePresentationSpec\nprivate final  boolean mPinned\npublic @android.annotation.NonNull @android.annotation.Size(min=0L) java.lang.String[] getAutofillHints()\nclass InlinePresentation extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genToString=true, genHiddenConstDefs=true, genEqualsHashCode=true)")
            inputSignatures = "private final @android.annotation.NonNull android.app.slice.Slice mSlice\nprivate final @android.annotation.NonNull android.widget.inline.InlinePresentationSpec mInlinePresentationSpec\nprivate final  boolean mPinned\npublic @android.annotation.NonNull @android.annotation.Size java.lang.String[] getAutofillHints()\nclass InlinePresentation extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genToString=true, genHiddenConstDefs=true, genEqualsHashCode=true)")
    @Deprecated
    private void __metadata() {}

+10 −24
Original line number Diff line number Diff line
@@ -137,11 +137,10 @@ public final class VerifiedKeyEvent extends VerifiedInputEvent implements Parcel
    // 3. add the "super" call for constructor that receives a Parcel
    // 4. add the "super" call to the writeToParcel method
    // 5. Update "equals" and "hashcode" methods to include VerifiedInputEvent fields
    // 6. Edit "inputSignatures" to ensure KeyEventAction is properly qualified



    // Code below generated by codegen v1.0.14.
    // Code below generated by codegen v1.0.20.
    //
    // DO NOT MODIFY!
    // CHECKSTYLE:OFF Generated code
@@ -180,7 +179,6 @@ public final class VerifiedKeyEvent extends VerifiedInputEvent implements Parcel
     *   this is the number of down/up pairs that have occurred.
     * @hide
     */
    @DataClass.Generated.Member
    public VerifiedKeyEvent(
            int deviceId,
            long eventTimeNanos,
@@ -198,16 +196,11 @@ public final class VerifiedKeyEvent extends VerifiedInputEvent implements Parcel
        com.android.internal.util.AnnotationValidations.validate(
                KeyEventAction.class, null, mAction);
        this.mDownTimeNanos = downTimeNanos;
        com.android.internal.util.AnnotationValidations.validate(
                SuppressLint.class, null, mDownTimeNanos,
                "value", "MethodNameUnits");
        this.mFlags = flags;
        this.mKeyCode = keyCode;
        this.mScanCode = scanCode;
        this.mMetaState = metaState;
        this.mRepeatCount = repeatCount;

        // onConstructed(); // You can define this method to get a callback
    }

    /**
@@ -301,10 +294,7 @@ public final class VerifiedKeyEvent extends VerifiedInputEvent implements Parcel
        VerifiedKeyEvent that = (VerifiedKeyEvent) o;
        //noinspection PointlessBooleanExpression
        return true
                && getDeviceId() == that.getDeviceId()
                && getEventTimeNanos() == that.getEventTimeNanos()
                && getSource() == that.getSource()
                && getDisplayId() == that.getDisplayId()
                && super.equals(that)
                && mAction == that.mAction
                && mDownTimeNanos == that.mDownTimeNanos
                && mFlags == that.mFlags
@@ -321,10 +311,7 @@ public final class VerifiedKeyEvent extends VerifiedInputEvent implements Parcel
        // int fieldNameHashCode() { ... }

        int _hash = 1;
        _hash = 31 * _hash + getDeviceId();
        _hash = 31 * _hash + Long.hashCode(getEventTimeNanos());
        _hash = 31 * _hash + getSource();
        _hash = 31 * _hash + getDisplayId();
        _hash = 31 * _hash + super.hashCode();
        _hash = 31 * _hash + mAction;
        _hash = 31 * _hash + Long.hashCode(mDownTimeNanos);
        _hash = 31 * _hash + mFlags;
@@ -341,6 +328,7 @@ public final class VerifiedKeyEvent extends VerifiedInputEvent implements Parcel
        // You can override field parcelling by defining methods like:
        // void parcelFieldName(Parcel dest, int flags) { ... }
        super.writeToParcel(dest, flags);

        dest.writeInt(mAction);
        dest.writeLong(mDownTimeNanos);
        dest.writeInt(mFlags);
@@ -361,6 +349,7 @@ public final class VerifiedKeyEvent extends VerifiedInputEvent implements Parcel
        // You can override field unparcelling by defining methods like:
        // static FieldType unparcelFieldName(Parcel in) { ... }
        super(in, VERIFIED_KEY);

        int action = in.readInt();
        long downTimeNanos = in.readLong();
        int flags = in.readInt();
@@ -373,9 +362,6 @@ public final class VerifiedKeyEvent extends VerifiedInputEvent implements Parcel
        com.android.internal.util.AnnotationValidations.validate(
                KeyEventAction.class, null, mAction);
        this.mDownTimeNanos = downTimeNanos;
        com.android.internal.util.AnnotationValidations.validate(
                SuppressLint.class, null, mDownTimeNanos,
                "value", "MethodNameUnits");
        this.mFlags = flags;
        this.mKeyCode = keyCode;
        this.mScanCode = scanCode;
@@ -400,10 +386,10 @@ public final class VerifiedKeyEvent extends VerifiedInputEvent implements Parcel
    };

    @DataClass.Generated(
            time = 1581107066890L,
            codegenVersion = "1.0.14",
            time = 1604509197793L,
            codegenVersion = "1.0.20",
            sourceFile = "frameworks/base/core/java/android/view/VerifiedKeyEvent.java",
            inputSignatures = "private static final  java.lang.String TAG\nprivate @android.view.VerifiedKeyEvent.KeyEventAction int mAction\nprivate @android.annotation.SuppressLint({\"MethodNameUnits\"}) long mDownTimeNanos\nprivate  int mFlags\nprivate  int mKeyCode\nprivate  int mScanCode\nprivate  int mMetaState\nprivate  int mRepeatCount\npublic @android.annotation.Nullable java.lang.Boolean getFlag(int)\nclass VerifiedKeyEvent extends android.view.VerifiedInputEvent implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genHiddenConstructor=true, genEqualsHashCode=true)")
            inputSignatures = "private static final  java.lang.String TAG\nprivate @android.view.VerifiedKeyEvent.KeyEventAction int mAction\nprivate @android.annotation.SuppressLint long mDownTimeNanos\nprivate  int mFlags\nprivate  int mKeyCode\nprivate  int mScanCode\nprivate  int mMetaState\nprivate  int mRepeatCount\npublic @android.annotation.Nullable java.lang.Boolean getFlag(int)\nclass VerifiedKeyEvent extends android.view.VerifiedInputEvent implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genHiddenConstructor=true, genEqualsHashCode=true)")
    @Deprecated
    private void __metadata() {}

Loading