Skip to content

AutoValue.CopyAnnotations does not apply to equals(Object). #579

@sebright2

Description

@sebright2

I am starting to run Checker Framework null analysis on https://github.com/census-instrumentation/opencensus-java. The Checker Framework requires equals to have a Nullable parameter (related to issue #73), so I tried using AutoValue.CopyAnnotations to copy the annotation from an abstract equals method to the generated subclass:

  @Override
  @AutoValue.CopyAnnotations
  public abstract boolean equals(@Nullable Object other);

CopyAnnotations had no effect on the generated equals method, so I instead tried putting a SuppressWarnings annotation on the whole method:

  @Override
  @SuppressWarnings("nullness")
  @AutoValue.CopyAnnotations
  public abstract boolean equals(Object other);

That change also had no effect on the generated method. I expected CopyAnnotations to copy annotations for any method or method parameter, including methods from Object.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions