-
Notifications
You must be signed in to change notification settings - Fork 15
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
[client] Write clients to the same package #546
Conversation
also make then final
For |
Handled |
Why do you want them in the same package? Why do you think that is better than having everything in |
Having the |
It's only the client interface - that's it. That client interface pretty much has to be public to be useful. |
To me this has negative impact on java module exports. That is, currently we can choose to export a package that only contains the interface with the option of exporting the package with the generated code/implementation or not. My expectation is that we often do not want the generated code in the exported package. |
@ferrazoli do you have anything else to add? |
I don't understand why you'd think that. Consider the following project structure:
Consider that
In this example, Here, not only there is no need for the client to be public, but there's also no reason why In this example, there are few resources involved, but in my real life example that led to this request, I have over 20 different resources that are related to an external API for product analytics, some of which have very generic names such as In an ideal world, Java has package hierarchy structures where I can make these resources available to sub-packages, but not to others, but we're not living in that world. 😄 I can't comment on what was said about module exports, but I just think that the generated code should respect my package visibility choices, which is something that avaje-inject does, but not avaje-http-client. Does this make sense or am I structuring my project in a silly way? I'm open to the possibility that there's a better way to do things which would eliminate my issue in the first place. Please advise. |
It could and it probably should. It's just not what this PR does currently. That is, I'm thinking this PR could change to satisfy both requirements. If the client interface is not public use the same package [to satisfy use case (B)], and when it is public use the
Effectively there are 2 use cases to consider. For the (A) case wrt java modules we really desire to export only the interface and we want to keep the actual implementation internal / not accessible such that others don't accidentally start depending on the implementation.
Yeah I got that wrong in that I forgot that also applied to Foo, FooResponse, Bar, BarResponse etc. I forgot about use case (B).
Thanks for that - I get it and this is exactly the sort of information we are after to understand the motivation any given change. For this case, this PR was created without that motivation explicitly stated so we've bounced around a bit here. Ideally for me, the motivation for ANY change is stated up front because we can equally "test the motivation" and look at the motivation for issues / flaws / side effects and that give us some confidence that we are changing things for the right reasons etc. edit:
This is the case because from a multi-module perspective DI components are basically mostly "internal" [not exported to other modules] where as for avaje-http-client we have use case (A) where we desire to only export the interface and keep the implementation internal. |
It does now |
@rbygrave can we get another RC for this? |
Don't always put GeneratedHttpComponent into .httpclient as the client interface might NOT be public now with 546
[client] Followup #546 - put GeneratedHttpComponent into top package
Thanks @rbygrave and @SentryMan ! ❤️ |
Is there a need for them to be in a separate package?
also make them final.