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

Change @Component to Guice @Inject #60

Merged
merged 2 commits into from
Dec 8, 2024
Merged

Change @Component to Guice @Inject #60

merged 2 commits into from
Dec 8, 2024

Conversation

elharo
Copy link
Contributor

@elharo elharo commented Nov 28, 2024

Need to check where this code is used. There are many subclasses spread across different plugins. Not sure how to navigate this.

Copy link
Member

@slawekjaranowski slawekjaranowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is used in every site reports plugin ... I wouldn't do such change

@elharo
Copy link
Contributor Author

elharo commented Nov 28, 2024

At some point we do want to get rid of the old plexus injection completely. It's worth thinking about how we're going to finish that job. If only we had a monorepo, and if wishes were horses...

@michael-o
Copy link
Member

How does this behave with concrete impls?

@elharo
Copy link
Contributor Author

elharo commented Nov 28, 2024

They're going to need to change so the injection happens in the subclass and the values are passed up the chain in a call to super. I've already done or am in the process of doing this in other plugins. The difference here is we don't have all the dependents in the same repo. :-(

@elharo elharo changed the title Remove @Component, rely on constructor injection in subclasses instead Change @Component to Guice @Inject Dec 5, 2024
@elharo
Copy link
Contributor Author

elharo commented Dec 5, 2024

We can try field injection as an intermediate step but we should get away from this eventually. It makes classes mutable and bypasses the usual object initialization, which is unnecessarily risky. It's also harder to write tests for.

@elharo elharo marked this pull request as ready for review December 5, 2024 23:26
@michael-o michael-o marked this pull request as draft December 8, 2024 14:06
@michael-o
Copy link
Member

Moving to da draft because I cannot estimate the impact...

Copy link
Member

@slawekjaranowski slawekjaranowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now by fields injection it is safe

@elharo elharo marked this pull request as ready for review December 8, 2024 15:27
@elharo elharo merged commit 62b264c into master Dec 8, 2024
36 checks passed
@elharo elharo deleted the guice branch December 8, 2024 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants