make GuiceModuleMetadata handle ParameterizedType's correctly #20
This commit is contained in:
committed by
Dave Syer
parent
db04553972
commit
5e14e96248
@@ -18,6 +18,7 @@ package org.springframework.guice.module;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.lang.reflect.ParameterizedType;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
@@ -96,7 +97,8 @@ public class GuiceModuleMetadata implements BindingTypeMatcher {
|
||||
|
||||
@Override
|
||||
public boolean matches(String name, Type type) {
|
||||
if (!matches(name) || !matches(type)) {
|
||||
Type rawType = type instanceof ParameterizedType ? ((ParameterizedType)type).getRawType() : type;
|
||||
if (!matches(name) || !matches(rawType)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -16,6 +16,9 @@ package org.springframework.guice.annotation;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.ExpectedException;
|
||||
@@ -126,5 +129,10 @@ public class GuiceModuleAnnotationTests {
|
||||
public Service service() {
|
||||
return new MyService();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Map<String,String> someParameterizedType() {
|
||||
return new HashMap<String,String>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user