|
|
@ -139,40 +139,35 @@ public class GenericTypeResolverTests { |
|
|
|
assertThat(x, equalTo((Type) Long.class)); |
|
|
|
assertThat(x, equalTo((Type) Long.class)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test // SPR-11030
|
|
|
|
public void getGenericsCannotBeResolved() throws Exception { |
|
|
|
public void getGenericsCannotBeResolved() throws Exception { |
|
|
|
// SPR-11030
|
|
|
|
|
|
|
|
Class<?>[] resolved = GenericTypeResolver.resolveTypeArguments(List.class, Iterable.class); |
|
|
|
Class<?>[] resolved = GenericTypeResolver.resolveTypeArguments(List.class, Iterable.class); |
|
|
|
assertNull(resolved); |
|
|
|
assertNull(resolved); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test // SPR-11052
|
|
|
|
public void getRawMapTypeCannotBeResolved() throws Exception { |
|
|
|
public void getRawMapTypeCannotBeResolved() throws Exception { |
|
|
|
// SPR-11052
|
|
|
|
|
|
|
|
Class<?>[] resolved = GenericTypeResolver.resolveTypeArguments(Map.class, Map.class); |
|
|
|
Class<?>[] resolved = GenericTypeResolver.resolveTypeArguments(Map.class, Map.class); |
|
|
|
assertNull(resolved); |
|
|
|
assertNull(resolved); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test // SPR-11044
|
|
|
|
public void getGenericsOnArrayFromParamCannotBeResolved() throws Exception { |
|
|
|
public void getGenericsOnArrayFromParamCannotBeResolved() throws Exception { |
|
|
|
// SPR-11044
|
|
|
|
|
|
|
|
MethodParameter methodParameter = MethodParameter.forExecutable( |
|
|
|
MethodParameter methodParameter = MethodParameter.forExecutable( |
|
|
|
WithArrayBase.class.getDeclaredMethod("array", Object[].class), 0); |
|
|
|
WithArrayBase.class.getDeclaredMethod("array", Object[].class), 0); |
|
|
|
Class<?> resolved = GenericTypeResolver.resolveParameterType(methodParameter, WithArray.class); |
|
|
|
Class<?> resolved = GenericTypeResolver.resolveParameterType(methodParameter, WithArray.class); |
|
|
|
assertThat(resolved, equalTo((Class<?>) Object[].class)); |
|
|
|
assertThat(resolved, equalTo((Class<?>) Object[].class)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test // SPR-11044
|
|
|
|
public void getGenericsOnArrayFromReturnCannotBeResolved() throws Exception { |
|
|
|
public void getGenericsOnArrayFromReturnCannotBeResolved() throws Exception { |
|
|
|
// SPR-11044
|
|
|
|
|
|
|
|
Class<?> resolved = GenericTypeResolver.resolveReturnType( |
|
|
|
Class<?> resolved = GenericTypeResolver.resolveReturnType( |
|
|
|
WithArrayBase.class.getDeclaredMethod("array", Object[].class), WithArray.class); |
|
|
|
WithArrayBase.class.getDeclaredMethod("array", Object[].class), WithArray.class); |
|
|
|
assertThat(resolved, equalTo((Class<?>) Object[].class)); |
|
|
|
assertThat(resolved, equalTo((Class<?>) Object[].class)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test // SPR-11763
|
|
|
|
public void resolveIncompleteTypeVariables() { |
|
|
|
public void resolveIncompleteTypeVariables() { |
|
|
|
// SPR-11763
|
|
|
|
|
|
|
|
Class<?>[] resolved = GenericTypeResolver.resolveTypeArguments(IdFixingRepository.class, Repository.class); |
|
|
|
Class<?>[] resolved = GenericTypeResolver.resolveTypeArguments(IdFixingRepository.class, Repository.class); |
|
|
|
assertNotNull(resolved); |
|
|
|
assertNotNull(resolved); |
|
|
|
assertEquals(2, resolved.length); |
|
|
|
assertEquals(2, resolved.length); |
|
|
|