[google-guice] push by cgruber@google.com - Use a single UniqueAnnotation instead of creating a new one each time.... on 2013-05-16 18:08 GMT

2 views
Skip to first unread message

google...@googlecode.com

unread,
May 16, 2013, 2:08:19 PM5/16/13
to google-g...@googlegroups.com
Revision: 9f8b438b370a
Author: Christian Edward Gruber <cgr...@google.com>
Date: Thu May 16 11:06:08 2013
Log: Use a single UniqueAnnotation instead of creating a new one each
time.

-----------------
Manually Synced.
COMMIT=45708839

http://code.google.com/p/google-guice/source/detail?r=9f8b438b370a

Modified:

/extensions/assistedinject/src/com/google/inject/assistedinject/FactoryProvider2.java

=======================================
---
/extensions/assistedinject/src/com/google/inject/assistedinject/FactoryProvider2.java
Thu May 16 11:00:54 2013
+++
/extensions/assistedinject/src/com/google/inject/assistedinject/FactoryProvider2.java
Thu May 16 11:06:08 2013
@@ -79,6 +79,9 @@
final class FactoryProvider2 <F> implements InvocationHandler,
ProviderWithExtensionVisitor<F>, HasDependencies,
AssistedInjectBinding<F> {

+ /** A constant annotation to denote the return value, instead of
creating a new one each time. */
+ static final Annotation RETURN_ANNOTATION = UniqueAnnotations.create();
+
/** if a factory method parameter isn't annotated, it gets this
annotation. */
static final Assisted DEFAULT_ANNOTATION = new Assisted() {
public String value() {
@@ -577,7 +580,7 @@
final Key<?> returnType = data.returnType;

// We ignore any pre-existing binding annotation.
- final Key<?> returnKey = Key.get(returnType.getTypeLiteral(),
UniqueAnnotations.create());
+ final Key<?> returnKey = Key.get(returnType.getTypeLiteral(),
RETURN_ANNOTATION);

Module assistedModule = new AbstractModule() {
@Override @SuppressWarnings("unchecked") // raw keys are necessary
for the args array and return value
Reply all
Reply to author
Forward
0 new messages