-
Notifications
You must be signed in to change notification settings - Fork 496
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
HDDS-10998. Declare annotation processors explicitly #6796
Conversation
Thank you for working on this @adoroszlai, the improvement in build speed looks really great, some 30% is too compelling I would say. If I understand correctly, this way the selected annotation processors would be used for the given module during compile time only, and I have a concern if this is true. |
Thanks @fapifta for the review. Annotation processing only happens at compile-time anyway, so there is no change in that. Before this patch, annotations are processed in This patch has two parts:
You are right that there is a chance of missing certain processors, either now due to a bug in this patch, or in the future by adding an annotation in some module that previously did not handle that one. This possibility is due to item 2. If we want to avoid it, we can list all supported processors in all modules with any Java code, even if currently unused. In any case, there is some leftover javadoc in |
Thanks for the explanation @adoroszlai! I can support this approach, however it would be nice to be on the safe side. |
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need to add the maven-compiler-plugin explicitly in every pom file even when we do not configure the path for an annotation processor?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would guess this is for number 2. limit the list of processors, or even disable processing completely, based on each module's needs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this case is for "disable processing".
I guess we could make <proc>none</proc>
the default by adding it in root POM, and overriding where necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately Java 8 doesn't provide any way to override <proc>none</proc>
, because the default ("process and compile") has no corresponding option. Later Java versions can use <proc>full</proc>
.
So we can simplify this only after dropping Java 8 support.
@fapifta done, thanks for the idea. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @adoroszlai for adding the import restrictions, it must have been a tedious work, but at the end of the day it gives us a good safety net on annotation usage within our codebase.
Let's revisit this once we drop Java8 support, should we capture the information regarding the tag somewhere in a TODO comment as part of this change or as a separate follow up JIRA?
Thanks @fapifta, @kerneltime for the review. |
What changes were proposed in this pull request?
Improve Gradle build cache usage by limiting the classpath elements where annotation processors are searched for. This gets rid of warnings emitted during compilation:
(Note: cache is currently only used in local builds, not in CI.)
https://issues.apache.org/jira/browse/HDDS-10998
How was this patch tested?
Local build time is reduced with the patch.
Before:
After:
CI:
https://github.com/adoroszlai/ozone/actions/runs/9435748229