Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to guava r19 broke my build: javax.annotation.CheckReturnValue not found #2450

Closed
patric-r opened this issue Apr 13, 2016 · 3 comments

Comments

@patric-r
Copy link

I'm facing an interesting problem:
After upgrading guava from r18 to r19, I cannot compile my project anymore, at least not with oracle javac (JDK 8u60 on linux):

[javac verbose logging enabled]

[javac] [loading ZipFileIndexFileObject[/myproduct/lib/common/log4j/apache-log4j-2.5-bin/log4j-core-2.5.jar(org/apache/logging/log4j/core/config/plugins/PluginVisitorStrategy.class)]]
[javac] error: cannot access CheckReturnValue
[javac]   class file for javax.annotation.CheckReturnValue not found
[javac] Note: Some input files use or override a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
[javac] 1 error

Switching back to guava r18 will make the build successful again.

I don't know exactly yet why this happens but I realized that compared to r18, with r19 now more class files contain references to javax.annotation.CheckReturnValue
Interestingly, the last logging statement before the error is related to a log4j2 class although I can not see how the class and the compile error are related.

@cpovirk
Copy link
Member

cpovirk commented Apr 14, 2016

I wonder if this is something that can be worked around by adding the dep that includes CheckReturnValue:

  <dependency>
    <groupId>com.google.code.findbugs</groupId>
    <artifactId>jsr305</artifactId>
    <version>1.3.9</version>
  </dependency>

Guava's dependency on jsr305 is marked optional, so it makes sense that the .class file would be missing. The weird part is that javac cares. My understanding is that javac shouldn't error out for mere missing annotations. But I can't find this specified anywhere, and I even found a bug report that suggests more or less the opposite.

My first suspicion would be that an annotation processor or other compiler plugin is causing the problem -- e.g., Lombok. Do you know if you're using any?

@patric-r
Copy link
Author

patric-r commented Apr 14, 2016

I'm not using any sort of compiler plugins / processors.
It's plain javac (invoked from ant).

Interesting fact: Eclipse compiles the same project without any errors.
I'll check whether adding the jsr305 dependency will workaround the issue.

@cpovirk
Copy link
Member

cpovirk commented May 6, 2019

Should be fixed now that we have "real" deps on jsr305.

See, e.g,. #2721 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants