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

Applying the checker plugin disables other annotation processors #20

Closed
akbertram opened this issue Jul 18, 2019 · 4 comments · Fixed by #45
Closed

Applying the checker plugin disables other annotation processors #20

akbertram opened this issue Jul 18, 2019 · 4 comments · Fixed by #45

Comments

@akbertram
Copy link

akbertram commented Jul 18, 2019

Rather than add checker to the annotationProcessor configuration, I believe the plugin is replacing the existing package:

          compile.options.annotationProcessorPath = project.configurations.checkerFramework

I have my own annotation processor that is part of our multi-module build and needs to run before checker, otherwise there are missing classes.

Also, specifying the -processor argument to javac disables the auto-discovery process, which means that my annotation processor is not found.

I have worked around this by adding my annotation processor to the checkerFramework configuration, but it would be nice to fix this.

@kelloggm
Copy link
Owner

Sorry you encountered this issue.

Rather than add checker to the annotationProcessor configuration, I believe the plugin is replacing the existing package:

I think you're right. I'll see if I can fix that right away and make a release.

Also, specifying the -processor argument to javac disables the auto-discovery process, which means that my annotation processor is not found.

This is, unfortunately, a fundamental problem. Because the Checker Framework provides many annotation processors and expects users to specify which ones to use, it is fundamentally incompatible with annotation processors discovered through javac's annotation processor discovery phase.

One option to fix that issue would be to re-implement that process in the plugin and then specify the processors that would have been run automatically. For now, manually specifying the processors you want to run will remain the workaround.

@akbertram
Copy link
Author

akbertram commented Jul 18, 2019 via email

@msridhar
Copy link
Collaborator

msridhar commented Sep 4, 2019

So is the current status still that if your build uses other annotation processors, those need to be added as checkers in order for them to still run after applying this plugin? That is going to painful for users of tools like AutoValue, which runs multiple annotation processors internally that are defined in a manifest file.

Maybe the plugin could support not specifying any checkers, which would mean that custom checkers that include a relevant manifest file would still be run? It's not a general solution, but it would support our current use case.

@msridhar
Copy link
Collaborator

msridhar commented Sep 5, 2019

Slightly crazy idea @kelloggm. How about instead of using the -processor argument, the plugin generates a META-INF/services/javax.annotation.processing.Processor file (as described here) to a new temporary directory, and then sticks that new temporary directory in the processor path for the build? I just did some tests and this should work just by placing the config file in a temp directory, without generating a temporary jar file each time. This should make the plugin compatible with processor auto-discovery, hopefully?

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