-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Introduce @CheckReturnValue into common Arc build items #38096
Conversation
This makes the IDE warn extension authors when they have created a build item but have not used it. I encountered this in quarkusio#38083 when I wrote something like: ```java UnremovableBeanBuildItem.beanTypes(Foo.class, Bar.class) ``` in a hurry and didn't stop to consider that the build item was never being produced
Well, these are static factory methods. What makes you think it would "produce" the build item as well? I mean it's like using a constructor 🤷. I'm not against adding those annotations but it feels a little bit inconsistent. Shouldn't we add this annotation to any factory method in any build item (which is IMO quite a common pattern)? Shouldn't we add this annotation to any constructor of a build item? |
You are right in all counts, however mistakes like this are easy to make when using static methods as opposed to constructors where the
I believe so, I only added it to the ones I find the most useful and most widely used.
I don't think so, because I seriously anyone would ever just create the build item with the constructor (as I mentioned earlier, the |
Failing Jobs - Building 9699fb8
Full information is available in the Build summary check run. Failures⚙️ Maven Tests - JDK 17 #- Failing: integration-tests/maven
📦 integration-tests/maven✖
✖
|
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.
Let's merge this, I don't want to check it again next time I do a review of the open PRs.
This makes the IDE warn extension authors when
they have created a build item but have not used it.
I encountered this in #38083 when I wrote something like:
in a hurry and didn't stop to consider that the build item
was never being produced.