Comment #2 on issue 366 by sberlin: @Provides methods don't respect null or
@Nullable
http://code.google.com/p/google-guice/issues/detail?id=366
The attached patch adds support for this... but in order to do it right, it
needs to add a few new methods to the API, so I'm attaching the patch
instead of committing it. Please give it a look over and let me know what
you think!
The new APIs are:
InjectionPoint.forMethod(Method, TypeLiteral) : InjectionPoint
Binder.getProvider(Dependency<T>) : Provider<T>
ProviderLookup(Object, Dependency<T>)
ProviderLookup.getDependency : Dependency<T>
They are required so that ProviderMethodsModule can get providers based on
a real dependency graph, instead of a free-standing dependency. That lets
the rest of Guice's internals solve nullability. It also lets the hack to
solve issue 482 be removed, because it's handled properly by Guice now.
(This could also be solved by iterating re-implementing Guice's internal
nullability checks, but IMO this is a cleaner solution, since it removes
workarounds for other bugs & also gives cleaner error messages.)
Attachments:
at-provides-nullability.txt 12.7 KB
--
You received this message because you are subscribed to the Google Groups
"google-guice-dev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-guice-dev?hl=en.