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

Downstream build fails when using annotation processor and compile options -Xlint:all -Werror #342

Open
rognan opened this issue Mar 28, 2024 · 7 comments
Labels
bug Something isn't working enhancement New feature or request gradle
Milestone

Comments

@rognan
Copy link

rognan commented Mar 28, 2024

Using the annotation processor in a build along with compiler options -Xlint:all -Werror fails the build with:

warning: No processor claimed any of these annotations:
/io.jstach.jstache.JStache,
... (other annotations which built just fine before jstachio)
/org.junit.jupiter.params.ParameterizedTest,
/org.junit.jupiter.api.io.TempDir

Note: Wrote services file: io.jstach.jstachio.spi.TemplateProvider
Note: Wrote services file: io.jstach.jstachio.spi.JStachioExtension

error: warnings found and -Werror specified
1 error
1 warning

Similar issue to the one solved in project lombok here.

@agentgt
Copy link
Contributor

agentgt commented Mar 28, 2024

I had originally claimed the annotations but errorprone says that is bad. I may need a flag. I’ll get this fixed for very soon.

@agentgt
Copy link
Contributor

agentgt commented Mar 28, 2024

https://errorprone.info/bugpattern/DoNotClaimAnnotations

I will check with the errorprone team as well.

I swore I have -Xlint:all -Werror in my other projects but maybe I'm mistaken.

@rognan
Copy link
Author

rognan commented Mar 28, 2024

I swore I have -Xlint:all -Werror in my other projects but maybe I'm mistaken.

Here's a proof of concept build as well as the workaround (Adding -Xlint:-processing)

@rognan
Copy link
Author

rognan commented Mar 28, 2024

https://errorprone.info/bugpattern/DoNotClaimAnnotations
💯

I didn't know this was problematic .. 🤷 I'm looking forward to errorprone's reply 👌

@agentgt
Copy link
Contributor

agentgt commented Mar 28, 2024

Apparently my other project had a flag to disable the warning but for a different reason.

Would adding an annotation processor flag be amenable for now?

Annotation processors look like -A and are covered in JStachio doc.

The issue is I can't add this till like at least a minor release and not a bug release.

The flag I can add as a bug release (well semver is sort of unclear on this because its not actual runtime but lets ignore that) which will not impact people relying on the annotation for whatever reasons.

Also how urgent is this for you?

@rognan
Copy link
Author

rognan commented Mar 28, 2024

Would adding an annotation processor flag be amenable for now?
Also how urgent is this for you?

Using -Xlint:-processing works fine for me for now - and if it turns out that errorprone is correct when they say that claiming annotations prevents other annotation processors from seeing the annotation, then it's probably something that should always be in effect.

@agentgt
Copy link
Contributor

agentgt commented Mar 28, 2024

Using -Xlint:-processing works fine for me for now

Yes that is the flag I have set in the other project. I will eventually add a flag as I can see an advantage to still have the warning applied to other processors.

Thanks for the bug report!

@agentgt agentgt added bug Something isn't working enhancement New feature or request gradle labels Mar 29, 2024
@agentgt agentgt added this to the v1.4.0 milestone Mar 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request gradle
Projects
None yet
Development

No branches or pull requests

2 participants