Comment #3 on issue 658 by sberlin: Make it clear how to do an optional
Injector.getInstance
http://code.google.com/p/google-guice/issues/detail?id=658
Two reasons
1) The code in question in Guice was written before getExistingBinding was
added
2) The better reason: It's an entirely different purpose. Raw
InjectionPoints have nothing to do with Injectors or Bindings or anything
like that. The code is looking reflectively at a class for all points with
an @Inject annotation. As part of doing that, it validates all the
annotations on the class (see InjectionPoint.forMember, line 106.) It adds
an error (which is converted to a ConfigurationException) if there are
two "binding annotations". If the injection point is optional, the
exception is ignored & the injection point is just dropped from the list of
potential injection points. To be honest, it probably shouldn't be
dropped & should instead error, since it's a real error and will _never_
get an injection... but, that's why it does it.
--
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.