-
Notifications
You must be signed in to change notification settings - Fork 1.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
Lacking injection point information when using the deprecated DependenyChain replacement. #1121
Comments
I'm going to give this a bump - any solution known? If not, is it possible to have this reverted? |
I hate to be one of those people who bumps so often, but it'd be great to get a response on this - @dimo414? |
@kashike sorry, I'm afraid I don't have any insights here. |
The DependencyChain got deprecated in the following commit: 99c1047 Or maybe a method to retrieve the dependency chain without the source (would reduce the internal dependency stack size by half: https://github.com/google/guice/blob/master/core/src/com/google/inject/internal/InternalContext.java#L46). |
@lukesandberg - input? |
another poke, @lukesandberg - input? |
I'm going to give this yet another poke - @lukesandberg? |
I'm going to give this yet another poke to try to get some kind of answer from the Guice team, please. |
Because of our custom SpongeInjectionPoint and use of Guava 21, we have to use a fork of Guice 5.0.1 that restores API removed in Guice 5 without a suitable alternative. Upstream issue: google/guice#1121 This newer version of Guice is needed to maintain compatibility with newer Java versions which plugin developers may want to use.
Because of our custom SpongeInjectionPoint and use of Guava 21, we have to use a fork of Guice 5.0.1 that restores API removed in Guice 5 without a suitable alternative. Upstream issue: google/guice#1121 This newer version of Guice is needed to maintain compatibility with newer Java versions which plugin developers may want to use.
Because of our custom SpongeInjectionPoint and use of Guava 21, we have to use a fork of Guice 5.0.1 that restores API removed in Guice 5 without a suitable alternative. Upstream issue: google/guice#1121 This newer version of Guice is needed to maintain compatibility with newer Java versions which plugin developers may want to use.
Because of our custom SpongeInjectionPoint and use of Guava 21, we have to use a fork of Guice 5.0.1 that restores API removed in Guice 5 without a suitable alternative. Upstream issue: google/guice#1121 This newer version of Guice is needed to maintain compatibility with newer Java versions which plugin developers may want to use.
Hi Folks -- Apologies for the lengthy delay in replying here. As commented on #1721, where @kashike proposed a relatively clean API for doing this... this is not something we're likely to incorporate into Guice. Changing what a Provider creates based on arbitrary data associated with the injection point that's being injected has thus far been an explicit anti-goal of Guice. If the returned type can change based on who's requesting it, that makes reasoning about the object graph much harder. Additionally, as far as quirks of the API go, I can't imagine how this would work with scopes. A straightforward implementation would capture whatever the first return value is & replay it to other injection points. That would be wrong, though I don't know what "right" should even be. |
The provided example to replace the deprecated dependency chain method doesn't provide enough context about which field or parameter is being injected. I tried to replace dependency chain method, but the most accurate I got was knowing which method/constructor/class is being injected.
Knowing which field/parameter is being injected allowed
Provider
s to return values based on the annotated elements, without having to bind each possible combination.The dependency chain solution can be found in the following PR changes: https://github.com/SpongePowered/SpongeCommon/pull/1435/files/1bd19db6f0b2363b8bc72960df0b0947e04cc1e0
A custom
InjectionPoint
is constructed from the information in the dependency chain, this object only exposes the annotations/type/target type of the field/parameter. There is also a small example available in the PR.Then I was looking for a different solution for the dependency chain and ended up stuck in the following changes:
LanternPowered/Lantern@f67d3e8
Not sure what the best solution could be to resolve the issue, undeprecating the
getDependencyChain
method is an option. Or similar to theInjectionPoint
injection, could it also be done for theDependency
by guice itself, making it unnecessary to scan the chain. Maybe you guys can find a better solution for this issue. Maybe there is even a different solution that I haven't been able to find.The text was updated successfully, but these errors were encountered: