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

[2.11.0] error_prone_annotations dependency #2676

Closed
ctabin opened this issue May 20, 2024 · 5 comments
Closed

[2.11.0] error_prone_annotations dependency #2676

ctabin opened this issue May 20, 2024 · 5 comments
Labels

Comments

@ctabin
Copy link

ctabin commented May 20, 2024

Hello,

We just saw the latest version 2.11.0 on Maven and updated to it. However, after a mvn dependency:tree this version now requires error_prone_annotations as dependency:

[INFO] +- com.google.code.gson:gson:jar:2.11.0:compile
[INFO] |  \- com.google.errorprone:error_prone_annotations:jar:2.27.0:compile

Is that really wanted or is it a build issue ? 🤔 ErrorProne is mainly used during compilation time and it seems strange to us that it would be used during runtime.

Thanks for the job !

@ctabin ctabin added the bug label May 20, 2024
@Marcono1234
Copy link
Collaborator

Yes this is intended, and is mentioned now in the release notes (which were published after you created this issue):

Added dependency on com.google.errorprone:error_prone_annotations
This dependency can be considered optional, but if missing it might lead to compiler warnings. Therefore Gson does not declare it as optional.

See #2346 and #2320 (comment). These Error Prone annotations are not only useful for Gson, but also for other projects using Gson which have configured Error Prone as well (and some annotations might also be recognized by IDEs). For example @InlineMe can help to migrate from deprecated Gson methods.

Is this causing any problems for you, or were you just curious if this was done intentionally?
You can try to add an exclusion for error_prone_annotations in your project configuration, but you might run into "Cannot find annotation method" warnings then when compiling against some of Gson's API. See the linked pull requests above.

@ctabin
Copy link
Author

ctabin commented May 20, 2024

Hi @Marcono1234,

Thanks for the reply. It was mainly a question, nothing to be related to a bug, but the dependency seemed suspect at first glance.

So, thanks for the clarification 👍

@ctabin ctabin closed this as completed May 20, 2024
@chadlwilson
Copy link

It seems to me that this is a little like google/guava#6606 where an attempt was made (is being made?) to correct the way these dependencies work for Gradle projects to avoid pulling in largely unnecessary runtime dependencies - and at least workaround Maven's inability to express the nature of the dependency correctly.

@eamonnmcmanus
Copy link
Member

Re google/guava#6606, @cpovirk from our team is following that and might want to comment here. My inclination is not to lose too much sleep over this "unneeded" dependency, since as @Marcono1234 notes they are potentially useful to clients that also use Error Prone, and also the jar is only 19K.

@cpovirk
Copy link
Member

cpovirk commented May 28, 2024

Now that you mention it, if we want Error Prone users to benefit, we should probably add @CheckReturnValue to our packages :) Until we do, the only benefit (at the moment) would be from a couple @InlineMe annotations.

(Others have already covered my main thoughts on the dependency here and in #2346 (comment).)

cpovirk added a commit to cpovirk/gson that referenced this issue May 31, 2024
cpovirk added a commit to cpovirk/gson that referenced this issue May 31, 2024
eamonnmcmanus added a commit that referenced this issue Jun 1, 2024
...as threatened in
#2676 (comment).

Co-authored-by: Éamonn McManus <emcmanus@google.com>
vruusmann added a commit to jpmml/r2pmml that referenced this issue Jul 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants