Lacking injection point information when using the deprecated DependenyChain replacement.
See original GitHub issueThe 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: https://github.com/LanternPowered/LanternServer/commit/f67d3e86af549b7e64c43f5f0de85d6fe5aaf211
Not sure what the best solution could be to resolve the issue, undeprecating the getDependencyChain
method is an option. Or similar to the InjectionPoint
injection, could it also be done for the Dependency
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.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:8
- Comments:8 (7 by maintainers)
Top GitHub Comments
another poke, @lukesandberg - input?
@lukesandberg - input?