History log of /external/guice/extensions/multibindings/test/com/google/inject/multibindings/SpiUtils.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
bed1413751f54dc6804dcb2a4c28300081788603 04-Nov-2014 flan <flan@google.com> Adds a binding for Collection<javax.inject.Provider<E>> to Multibinder.
Before, only a Collection<com.google.inject.Provider<E>> was bound; now
both are bound.

Note that this required changes to SpiUtils because MapBinder uses a
Multibinder to bind Set<Entry<K, Provider<V>>. There is a bit of
strangeness here because it means that there is now a binding for
Collection<javax.inject.Provider<Map.Entry<K, Provider<V>>>.
Tested:
All existing and modified tests pass.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=79191051
/external/guice/extensions/multibindings/test/com/google/inject/multibindings/SpiUtils.java
615fd2bc2397e2966d682759aae2aad7e8a3db1e 04-Nov-2014 flan <flan@google.com> Make SpiUtils tests more accurate by multiplying the expected results instead
of dividing the actual results. Before, some bindings weren't being checked
and this was overlooked by the tests due to rounding down the number of
leftover bindings.

Tested:
All existing tests pass.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=79167431
/external/guice/extensions/multibindings/test/com/google/inject/multibindings/SpiUtils.java
9c8b61815fa15ee3457b9c816afe24a6fdaf7014 04-Nov-2014 flan <flan@google.com> Simplifies Multibinder by moving Key generation to RealMultibinder's
constructor.

Tested:
All existing tests pass.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=79159620
/external/guice/extensions/multibindings/test/com/google/inject/multibindings/SpiUtils.java
1d3f8cd0a163c7439589d80e6377edbf2ca4b43d 08-Oct-2014 sameb <sameb@google.com> Add support for java.util.Optional, reflectively. If the class exists, we bind
it the same way we bind com.google.common.base.Optional. Update tests
accordingly.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=77215848
/external/guice/extensions/multibindings/test/com/google/inject/multibindings/SpiUtils.java
4faa20e3081448792933834aedfe972add806292 11-Aug-2014 Sam Berlin <sameb@google.com> Updating Multibinder to support injection of Collection<Provider<T>> alongside the usual Set<T>.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=72818888
/external/guice/extensions/multibindings/test/com/google/inject/multibindings/SpiUtils.java
e5abfb2c1e4ff087bafa5d925fe0598d968b803b 06-Aug-2014 Sam Berlin <sameb@google.com> Do some extra casting to workaround jdk6 compilation issues in SpiUtils.
/external/guice/extensions/multibindings/test/com/google/inject/multibindings/SpiUtils.java
c34e0185fcf508a890c6cd13bdafeb505c3e9e8a 06-Aug-2014 Sam Berlin <sameb@google.com> Implement binding deduplication for multibinder & mapbinder in a different way.
Instead of relying on Guice binding deduplication (and hacking up RealElement
to break the annotation contract to do so, causing weirdness in WeakKeySet &
forcing us to care about "rehashing keys"), we instead deduplicate within
Multibinder. The downside of this is that toInstance or toProvider(instance)
bindings that are deduplicated will remain in the object graph but effectively
be unreachable. However, that's a downside I'm willing to live with to remove
this hack.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=72570932
/external/guice/extensions/multibindings/test/com/google/inject/multibindings/SpiUtils.java
842f351c4b2b3b0a90d9f3bcf164d8fd19aede6c 10-Jul-2014 Sam Berlin <sameb@google.com> Add support for OptionalBinder to link to normal bindings of that type if
neither setDefault nor setBinding are called. From the javadoc, example:

* <pre><code>
* public class FrameworkModule extends AbstractModule {
* protected void configure() {
* OptionalBinder.newOptionalBinder(binder(), Renamer.class);
* }
* }</code></pre>
*
* <p>With this module, an {@link Optional}{@code <Renamer>} can now be
* injected. With no other bindings, the optional will be absent.
* Users can specify bindings in one of two ways:
*
* <p>Option 1:
* <pre><code>
* public class UserRenamerModule extends AbstractModule {
* protected void configure() {
* bind(Renamer.class).to(ReplacingRenamer.class);
* }
* }</code></pre>
*
* <p>or Option 2:
* <pre><code>
* public class UserRenamerModule extends AbstractModule {
* protected void configure() {
* OptionalBinder.newOptionalBinder(binder(), Renamer.class)
* .setBinding().to(ReplacingRenamer.class);
* }
* }</code></pre>
* With both options, the {@code Optional<Renamer>} will be present and supply the
* ReplacingRenamer.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=70835975
/external/guice/extensions/multibindings/test/com/google/inject/multibindings/SpiUtils.java
c66f08e3d6798e88f35be51679854568f337e7eb 10-Jul-2014 Sam Berlin <sameb@google.com> Automated g4 rollback of changelist 70738452.

*** Reason for rollback ***

Fix projects that were doing dependency analysis by returning a dependency on the Injector when run on raw Elements (instead of a dependency on @Actual+@Default, even though we didn't know which would really exist).

*** Original change description ***

Automated g4 rollback of changelist 70734332.

*** Reason for rollback ***

Broke a project.

*** Original change description ***

Simplify OptionalBinder implementation to not delegate to a MapBinder.
Instead, bind directly to annotated @Actual/@Default keys. This is in
preparation for future improvements.

This contains two logical changes:
1) The error message for duplicate actual/default bindings is now the default Guice message, instead of a custom thing in MapBinder.
2) getDependencies now...

***
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=70742247
/external/guice/extensions/multibindings/test/com/google/inject/multibindings/SpiUtils.java
8f89a23e16435f81bd4e083185f2f2c5a520f954 10-Jul-2014 Sam Berlin <sameb@google.com> Automated g4 rollback of changelist 70734332.

*** Reason for rollback ***

Broke a project.

*** Original change description ***

Simplify OptionalBinder implementation to not delegate to a MapBinder.
Instead, bind directly to annotated @Actual/@Default keys. This is in
preparation for future improvements.

This contains two logical changes:
1) The error message for duplicate actual/default bindings is now the default Guice message, instead of a custom thing in MapBinder.
2) getDependencies now returns the live dependency (either the actual or the default, not both). Also, Optional<Provider<T>> continues to return a de...

***
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=70738452
/external/guice/extensions/multibindings/test/com/google/inject/multibindings/SpiUtils.java
9040306545ddd134a8b0ebe97a21b581cc3df962 10-Jul-2014 Sam Berlin <sameb@google.com> Simplify OptionalBinder implementation to not delegate to a MapBinder.
Instead, bind directly to annotated @Actual/@Default keys. This is in
preparation for future improvements.

This contains two logical changes:
1) The error message for duplicate actual/default bindings is now the default Guice message, instead of a custom thing in MapBinder.
2) getDependencies now returns the live dependency (either the actual or the default, not both). Also, Optional<Provider<T>> continues to return a dep to Provider<T>, but Optional<T> returns a dep of T directly.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=70734332
/external/guice/extensions/multibindings/test/com/google/inject/multibindings/SpiUtils.java
af24f632f90fc91daeb30172b874405c131592c8 02-Apr-2014 Christian Edward Gruber <cgruber@google.com> Adds a new OptionalBinder. OptionalBinder allows frameworks to setup bindings for items that user code may or may not bind. It also allows frameworks to set default values that users can override.

The API is:
OptionalBinder.newOptionalBinder(Binder, Class|TypeLiteral|Key) -> OptionalBinder
optionalBinder.setDefault -> LinkedBindingBuilder
optionalBinder.setBinding -> LinkedBindingBuilder

By way of example, this will do:

newOptionalBinder(..) -> @Inject Thing -> exception: neither setDefault nor setBinding called
newOptionalBinder(..) -> @Inject Optional<Thing> -> isPresent() == false
newOptionalBinder(..).setDefault().to("a") -> @Inject Thing -> "a"
newOptionalBinder(..).setDefault().to("a") -> @Inject Optional<Thing> --> get() == "a"
newOptionalBinder(..).setDefault().to("a") + newOptionalBinder(..).setBinding().to("b") -> @Inject Thing -> "b"
newOptionalBinder(..).setDefault().to("a") + newOptionalBinder(..).setBinding().to("b") -> @Inject Optional<Thing> -> get() == "b"
newOptionalBinder(..).setBinding().to("b") -> @Inject Thing -> "b"
newOptionalBinder(..).setBinding().to("b") -> @Inject Optional<Thing> -> get() == "b"
newOptionalBinder(..).setDefault().to("a") + newOptionalBinder(..).setDefault().to("b") -> configuration exception
newOptionalBinder(..).setBinding().to("a") + newOptionalBinder(..).setBinding().to("b") -> configuration exception

(This also adds the jsr305 jar for build time, because doclava wanted it. Frustrating.)

(This also fixes users that implemented MultibindingsTargetVisitor, because I can't use default methods yet.)
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=63873859
/external/guice/extensions/multibindings/test/com/google/inject/multibindings/SpiUtils.java
8ad60eb50961e000c89099bb767489cf551d995b 10-Mar-2014 Sam Berlin <sameb@google.com> Change LinkedBindingBuilder.toProvider(Provider) to accept a jsr330 provider,
in addition to the Guice Provider. This is an incompatible change for people who extend LinkedBindingBuilder, but not for people who use it.

This will allow people to switch to JSR330 types more easily.

LinkedBindingBuilder needs both toProvider(Provider) and toProvider(javax.inject.Provider) because precompiled jars (e.g, stuff in third_party, maven, etc..) that used toProvider(Provider) would otherwise throw a NoSuchMethodError.

I left the getProviderInstance method on ProviderInstanceBinding, otherwise
that would require anyone using the SPI method to change their code to accept
the weaker type.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=61966924
/external/guice/extensions/multibindings/test/com/google/inject/multibindings/SpiUtils.java
3338a48b6abb9a0641dc3c2c169bb59b9960dc15 06-Dec-2013 Sam Berlin <sameb@google.com> Fix issue 734 -- MapBinder doesn't allow injection of Map<K, javax.inject.Provider<V>>.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=57798745
/external/guice/extensions/multibindings/test/com/google/inject/multibindings/SpiUtils.java
6c69bcf53d4122b0f05f44783c0d8a61afd83911 18-Sep-2013 Christian Edward Gruber <cgruber@google.com> An alternative way to support ShareableModule, Modules.override and Multibinder: use annotations that compare equal iff the binding strategy matches, so Guice will dedupe for us.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=50556753
/external/guice/extensions/multibindings/test/com/google/inject/multibindings/SpiUtils.java
bf2b16c06a5ff7c099fe60f9a46cfb130ce45962 16-May-2013 Christian Edward Gruber <cgruber@google.com> Add support for ProvisionListeners to notify on toInstance & constant bindings.

---------------------
Manually synced.
COMMIT=41634417
/external/guice/extensions/multibindings/test/com/google/inject/multibindings/SpiUtils.java
b7a02b02d81c830d148355c90bc309bcd66fb592 08-Jul-2011 sberlin <sberlin@d779f126-a31b-0410-b53b-1d3aecad763e> * Remove unused imports
* Sort imports
* Convert tabs to spaces
* Fix the ant no_aop build


Revision created by MOE tool push_codebase.
MOE_MIGRATION=2532


git-svn-id: https://google-guice.googlecode.com/svn/trunk@1572 d779f126-a31b-0410-b53b-1d3aecad763e
/external/guice/extensions/multibindings/test/com/google/inject/multibindings/SpiUtils.java
4e11457f34addf5d10fe0c31cefd54c75c37b540 29-Jun-2011 sberlin <sberlin@d779f126-a31b-0410-b53b-1d3aecad763e> fixup whitespace

git-svn-id: https://google-guice.googlecode.com/svn/trunk@1563 d779f126-a31b-0410-b53b-1d3aecad763e
/external/guice/extensions/multibindings/test/com/google/inject/multibindings/SpiUtils.java
d9c913acca55023ef5d76a32c3d4a51ee6b420cb 26-Jun-2011 sberlin <sberlin@d779f126-a31b-0410-b53b-1d3aecad763e> switch Guice from manually repackaging Guava to depending on Guava. it's still jarjar'd right now, which is causing a ~400k increase in guice-snapshot.jar. next step is to switch to ProGuard to remove the unnecessary code and cut it back down (even further?!). this will let people build from Guice source and depend directly on Guava code without having to worry about hiding internal/util.

git-svn-id: https://google-guice.googlecode.com/svn/trunk@1558 d779f126-a31b-0410-b53b-1d3aecad763e
/external/guice/extensions/multibindings/test/com/google/inject/multibindings/SpiUtils.java
75fcf6f3a7ae2000b8ed85038dfd33bedd0503fa 20-Sep-2010 sberlin <sberlin@d779f126-a31b-0410-b53b-1d3aecad763e> issue 539 - extension SPI for Multibinder/MapBinder.

git-svn-id: https://google-guice.googlecode.com/svn/trunk@1253 d779f126-a31b-0410-b53b-1d3aecad763e
/external/guice/extensions/multibindings/test/com/google/inject/multibindings/SpiUtils.java