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

Actually call default methods in AssistedInject factories #1347

Closed
wants to merge 1 commit into from

Conversation

ogregoire
Copy link

Fixes #1345

@sameb
Copy link
Member

sameb commented Apr 18, 2023

Thanks for this PR. We unfortunately can't merge it, though, because we have no way of knowing if the factory author wants Guice to override the default methods. Merging would break folks who are relying on the current behavior. We could consider an additional annotation (like @IgnoreThisForAssistedInjection), but that's pretty darn heavyweight and not very ergonomic.

Ultimately, the best solution is for folks to create a separate factory with just the methods they'd like Guice to fit to assisted injection.

@sameb sameb closed this Apr 18, 2023
@kashike
Copy link
Contributor

kashike commented Aug 4, 2023

I recently ran into this issue too - some sort of way (even if not the prettiest - an annotation like @sameb mentioned is not the worst) to support this would be great.

jpenilla added a commit to jpenilla/guice that referenced this pull request Aug 4, 2023
…thods on assisted factories (but only when explicitly requested by the user, see google#1347 (comment))
jpenilla added a commit to jpenilla/guice that referenced this pull request Aug 5, 2023
…thods on assisted factories (but only when explicitly requested by the user, see google#1347 (comment))
jpenilla added a commit to jpenilla/guice that referenced this pull request Aug 5, 2023
…thods on assisted factories (but only when explicitly requested by the user, see google#1347 (comment))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AssistedInject factories should call their default methods without stubbing
4 participants