-
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
Make io.quarkus.builder.Consume
a record
#45633
Conversation
@gastaldi please lets finally get this done, thanks. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@punkratz312 I am not sure how you are building the project, but wasn't formatted properly. Anyway, I built with |
io.quarkus.builder.Consume
a record
This comment has been minimized.
This comment has been minimized.
Ooops, forgot to commit the changes 😅 |
Frankly, I'm not sure it's a good idea to merge this: the value is very narrow and I'm not excited about all the conflicts we will end up having if we start converting a lot of classes to records. Why this class? Does it actually bring some serious improvements? Now @gastaldi I will let you judge of this particular case but let me be clear: I don't want us to convert a lot of classes to records, we can adjust when there's real value but we have to take into account the potential maintenance burden of handling the backports and potential conflicts with the getter name changes. If it makes things awesomely better then we can swallow this burden, if it doesn't, why would we? |
@punkratz312 if I had an advice for you, it would be: if you actually want to contribute to Quarkus, try to handle a bug open in our tracker and fix it. That would be more valuable for us than changing a random class in the tree to a record. I also think it would be a better learning experience for you. |
@gsmet I agree it doesn't add much value. However, accepting this PR will not hurt, given this class is package-private.
@punkratz312 if you're looking for an issue to work on, take a look at the ones labeled |
I see valid arguments in every direction. However, my main point is to remove the dead code, which was the original purpose of initiating this PR. Subsequently, the suggestion to adopt the record approach refined it into the most minimalistic solution possible. You can't take anything away from it without breaking everything. This adheres to the principle of having only what's necessary and avoiding overhead, which aligns with Quarkus' philosophy—minimizing imports and focusing on performance. It's fascinating what it's already achieving in terms of optimization. Of course, this change could raise the question: why not use the record approach universally if it's so beneficial? In my humble opinion, it comes down to maintainability. IDE warnings always catch my attention, and refactoring (the second phase of TDD) helps eliminate redundancy and replication, which is something I strongly advocate for. I don’t see how this internal change would cause any conflicts since it's encapsulated within the PS: Of course, this is not about introducing this framework—just wanted to mention it to give a broader picture. |
@punkratz312 that's not dead code, the code is being used in other places, as you have noticed since you changed 3 files. Migrating everything to record is a bad idea when you have API changes, since it will break existing code depending on it (this PR is an exception since the class is used internally only). We already use OpenRewrite in the |
not all the coding, but some getters are marked as unused. |
This comment has been minimized.
This comment has been minimized.
A lot of unused and unnecessary boilerplate makes it hard to see that it's actually just one tiny function. With records, it's a blink of an eye to understand, which is what maintenance should be about. The focus should be to make the code easy to maintain and understand for humans. |
This needs a rebase as there is a conflict |
resolved |
Status for workflow
|
All checks have passed looks good now, right? |
thanks |
This pull request reduces boilerplate code and eliminates unused code, addressing concerns related to code clarity and maintenance.
This change aims to streamline the codebase while maintaining functionality.