Comment #2 on issue 290 by phopkins: New BindingTargetVisitor interface  
needs wildcard types
http://code.google.com/p/google-guice/issues/detail?id=290

Sorry, yes, "bounded wildcard" is the more correct term. It is certainly  
arguable that when you talk about Guice
Bindings you may not strictly care about inheritance: a binding to String  
is different from a binding to
CharSequence, and therefore you may want to keep the non-bounded types.

That being said, I don't see any "weakening" going on. With the "super"s  
and "extends" in the right places, you
can still do:

injector.getBinding(String.class).acceptTargetVisitor(new  
DefaultBindingTargetVisitor<String, Object>() { ... });

and everything's still typesafe. (E.g. InstanceBinder#getInstance() returns  
a String.) You just need to put the
right wildcard bounds in your visitor's method signatures.

At any rate, I'm running into this with the Graphviz grapher. I have a  
Visitor that needs to run over all of the
Bindings in the Module, regardless of the type (and I suspect that this  
will be a common case for tools). I can
do the unchecked cast to Binding<Object> and run the visitor on that, but  
it seems a bit of a hack.

Nevertheless, the inconsistency around ProviderBinding extending  
Binding<Provider<T>> is I think still a
bug, regardless of the other typing.

--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to