Skip to content

Commit

Permalink
Update Dagger info in poms
Browse files Browse the repository at this point in the history
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=120714957
  • Loading branch information
ronshapiro authored and sameb committed Jun 13, 2016
1 parent ad50eef commit c39f4cb
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 4 deletions.
Binary file removed extensions/dagger-adapter/lib/dagger-2.0.jar
Binary file not shown.
Binary file added extensions/dagger-adapter/lib/dagger-2.4.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion extensions/dagger-adapter/pom.xml
Expand Up @@ -18,7 +18,7 @@
<dependency>
<groupId>com.google.dagger</groupId>
<artifactId>dagger</artifactId>
<version>2.0</version>
<version>2.4</version>
</dependency>
</dependencies>
</project>
Expand Up @@ -24,6 +24,9 @@
import com.google.inject.spi.ModuleAnnotatedMethodScanner;

import dagger.Provides;
import dagger.multibindings.IntoSet;
import dagger.multibindings.ElementsIntoSet;
import dagger.multibindings.IntoMap;
import dagger.Provides.Type;

import java.lang.annotation.Annotation;
Expand All @@ -46,12 +49,24 @@ final class DaggerMethodScanner extends ModuleAnnotatedMethodScanner {
Binder binder, Annotation rawAnnotation, Key<T> key, InjectionPoint injectionPoint) {
Method providesMethod = (Method) injectionPoint.getMember();
Provides annotation = (Provides) rawAnnotation;
if (providesMethod.isAnnotationPresent(IntoSet.class)) {
return processSetBinding(binder, key);
} else if (providesMethod.isAnnotationPresent(ElementsIntoSet.class)) {
binder.addError("@ElementsIntoSet contributions are not suppored by Guice.", providesMethod);
return key;
} else if (providesMethod.isAnnotationPresent(IntoMap.class)) {
/* TODO(cgruber) implement map bindings */
binder.addError("Map bindings are not yet supported.");
return key;
}

switch (annotation.type()) {
case UNIQUE:
return key;
case MAP:
/* TODO(cgruber) implement map bindings */
binder.addError("Map bindings are not yet supported.");
return key;
case SET:
return processSetBinding(binder, key);
case SET_VALUES:
Expand All @@ -72,4 +87,4 @@ private static <T> Key<T> processSetBinding(Binder binder, Key<T> key) {
}

private DaggerMethodScanner() {}
}
}
Expand Up @@ -28,6 +28,8 @@
import com.google.inject.multibindings.Multibinder;
import com.google.inject.util.Providers;

import dagger.multibindings.IntoSet;

import junit.framework.TestCase;

import java.util.Set;
Expand Down Expand Up @@ -65,7 +67,9 @@ public void testInteractionWithGuiceModules() {
}

@dagger.Module static class SetBindingDaggerModule1 {
@dagger.Provides(type=SET) Integer anInteger() {
@dagger.Provides
@IntoSet
Integer anInteger() {
return 5;
}
}
Expand Down
1 change: 0 additions & 1 deletion extensions/pom.xml
Expand Up @@ -18,7 +18,6 @@

<modules>
<module>assistedinject</module>
<!-- TODO(cgruber): Comment out dagger-adapter module if guice releases before dagger 2.x -->
<module>dagger-adapter</module>
<module>grapher</module>
<module>jmx</module>
Expand Down

0 comments on commit c39f4cb

Please sign in to comment.