Status: New
Owner: ----
New issue 791 by [email protected]: Multibinder Bindings Don't Always
Respect Singleton Scope
http://code.google.com/p/google-guice/issues/detail?id=791
Description of the issue:
When using the multibinder, if you use
`binder.addBinding().to(B.class).in(Singleton.class);` it will not enforce
the singleton nature on that object, but using the `@Singleton` annotation
directly will.
Steps to reproduce:
1. Create a Multibinder.newSetBinder instance with an interface.
2. Bind an implementation using `.in(Singleton.class)`.
3. Bind another implementation annotated with `@Singleton`.
4. Inspect that the instances retrieved are not singletons in the cases
where `.in(Singleton.class)` was used, but are in the cases where
`@Singleton` was used.
Expected behavior:
- I'd expect for .in(Singleton.class) to work, to not be exposed, or to
throw an exception.
The attached tests illustrate the problem: `getInstance_ofSet_ContainsB`
and `getInstance_ofB_IsIdentical` both fail under both Guice 3.0 and Guice
4.0-beta.
Attachments:
GuiceTest.java 1.4 KB
--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
--
You received this message because you are subscribed to the Google Groups
"google-guice-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-guice-dev.
For more options, visit https://groups.google.com/groups/opt_out.