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

Updating Guice to 4.0 and deleting temporary injections #3644

Merged
merged 11 commits into from
Oct 4, 2023

Conversation

Robertorosmaninho
Copy link
Collaborator

@Robertorosmaninho Robertorosmaninho commented Sep 14, 2023

This modification aimed to update the Guice version from 4.0-beta5 to 4.0, deleting the constructors with one void parameter to

Prevents instantiation by Guice when not explicitly configured in a Module.

And applying the requireAtInjectOnConstructors on every constructor() inside a class that extends the AbstractModule for consistency. These modifications made it necessary to explicitly create constructors with zero parameters and within the @Injector annotation.

@Robertorosmaninho Robertorosmaninho added the dependencies Pull requests that update a dependency file label Sep 14, 2023
@Robertorosmaninho Robertorosmaninho self-assigned this Sep 14, 2023
@rv-jenkins rv-jenkins changed the base branch from master to develop September 14, 2023 22:04
Copy link
Collaborator

@dwightguth dwightguth left a comment

Choose a reason for hiding this comment

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

There's some context involved here. Guice 4.0 includes an option to disable injection of zero argument constructors implicitly. The plan was to enable this option and then explicitly inject everything that was previously being injected implicitly. You probably don't want to delete those constructors unless you do this, otherwise you might accidentally inject the wrong values for options if your guice configuration has a bug, rather than reporting an error. I wholeheartedly agree with updating to the release of guice though.

@Robertorosmaninho
Copy link
Collaborator Author

Robertorosmaninho commented Sep 19, 2023

There's some context involved here. Guice 4.0 includes an option to disable injection of zero argument constructors implicitly. The plan was to enable this option and then explicitly inject everything that was previously being injected implicitly. You probably don't want to delete those constructors unless you do this, otherwise you might accidentally inject the wrong values for options if your guice configuration has a bug, rather than reporting an error. I wholeheartedly agree with updating to the release of guice though.

Hey @dwightguth, to make sure that we're on the same page here. Do you mean the requireAtInjectOnConstructors, right?

@Robertorosmaninho Robertorosmaninho marked this pull request as draft September 22, 2023 14:56
@Robertorosmaninho
Copy link
Collaborator Author

Hey @dwightguth, I still have some configure() to adapt, but I would like feedback here just to check that I'm on the correct path. Could you please take a look at it?

@Robertorosmaninho Robertorosmaninho marked this pull request as ready for review September 25, 2023 14:27
Copy link
Collaborator

@dwightguth dwightguth left a comment

Choose a reason for hiding this comment

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

This looks great assuming you can get it to work with every class extending AbstractModule being modified.

@Robertorosmaninho
Copy link
Collaborator Author

Hey @dwightguth, all the modules that extend the AbstractModule were modified to work with this. I made the modifications after my comment!

@rv-jenkins rv-jenkins merged commit 079db21 into develop Oct 4, 2023
@rv-jenkins rv-jenkins deleted the guice-update branch October 4, 2023 19:22
@Baltoli Baltoli mentioned this pull request Dec 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants