Skip to content

Auto-value generated file compilation error: Misleading error message on missing transitive dependency #4105

Closed

Description

@davido

It took me hours to track this down, why compilation of generated source by annotaion processor (the latest auto-value library) is failing with obscure error message. It seems that the root cause is missing transitive dependency.

To reproduce, clone this repro-repository: https://github.com/davido/bazel-annotation-processor-breakage and follow the README.md. The workaround is provided as well. I would expect that a sane error message is reported, and not:

bazel build java/com/google/gerrit/server/diff:diff 
INFO: Analysed target //java/com/google/gerrit/server/diff:diff (1 packages loaded).
INFO: Found 1 target...
ERROR: /home/davido/projects/bazel-annotation-processor-breakage/java/com/google/gerrit/server/diff/BUILD:3:1: Building java/com/google/gerrit/server/diff/libdiff.jar (1 source file) and running annotation processors (AutoAnnotationProcessor, AutoValueProcessor) failed (Exit 1)
bazel-out/k8-fastbuild/bin/java/com/google/gerrit/server/diff/_javac/diff/libdiff_sourcegenfiles/com/google/gerrit/server/diff/AutoValue_IntraLineDiffArgs.java:51: error: method equals in class NameKey cannot be applied to given types;
      return (this.project.equals(that.project()))
                          ^
  required: Object
  found: NameKey
  reason: argument mismatch; NameKey cannot be converted to Object

Activity

  1. cushon commented on Nov 17, 2017

    @cushon
    Contributor

    This appears to be caused by Error Prone:

    $ bazel build --javacopt=-XepDisableAllChecks java/com/google/gerrit/server/diff:diff
    ...
    bazel-out/local-fastbuild/bin/java/com/google/gerrit/server/diff/_javac/diff/libdiff_sourcegenfiles/com/google/gerrit/server/diff/AutoValue_IntraLineDiffArgs.java:51: error: cannot access StringKey
          return (this.project.equals(that.project()))
                              ^
      class file for com.google.gwtorm.client.StringKey not found
    
  2. davido commented on Nov 17, 2017

    @davido
    ContributorAuthor

    @cushon Thanks. Surprisingly, the original issue in gerrit wasn't exposed on sane platforms (Linux & Mac Os X), but was only reported on the other platform. However, with this small reproducer, it now exposed on Linux as well.

    Should I close this issue here and rather re-open a new one for EP?

  3. davido commented on Nov 19, 2017

    @davido
    ContributorAuthor

    Duplicate of #4108.

  4. added a commit that references this issue on Nov 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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