forked from google/guice
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement binding deduplication for multibinder & mapbinder in a diff…
…erent 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
- Loading branch information
Showing
26 changed files
with
457 additions
and
679 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,7 +41,7 @@ | |
* @author [email protected] (Jesse Wilson) | ||
*/ | ||
public class BindingBuilder<T> extends AbstractBindingBuilder<T> | ||
implements AnnotatedBindingBuilder<T>, RehashableKeys { | ||
implements AnnotatedBindingBuilder<T> { | ||
|
||
public BindingBuilder(Binder binder, List<Element> elements, Object source, Key<T> key) { | ||
super(binder, elements, source, key); | ||
|
@@ -171,10 +171,6 @@ public <S extends T> ScopedBindingBuilder toConstructor(Constructor<S> construct | |
return this; | ||
} | ||
|
||
public void rehashKeys() { | ||
setBinding(getBinding().withRehashedKeys()); | ||
} | ||
|
||
@Override public String toString() { | ||
return "BindingBuilder<" + getBinding().getKey().getTypeLiteral() + ">"; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.