diff --git a/src/main/java/org/springframework/data/util/TypeDiscoverer.java b/src/main/java/org/springframework/data/util/TypeDiscoverer.java index 8877b1d6c..f13ffd84d 100644 --- a/src/main/java/org/springframework/data/util/TypeDiscoverer.java +++ b/src/main/java/org/springframework/data/util/TypeDiscoverer.java @@ -597,7 +597,7 @@ class TypeDiscoverer implements TypeInformation { Type[] result = new Type[typeParameters.size()]; for (int i = 0; i < typeParameters.size(); i++) { - result[i] = typeParameters.get(0).getType(); + result[i] = typeParameters.get(i).getType(); } return result; diff --git a/src/test/java/org/springframework/data/util/ClassTypeInformationUnitTests.java b/src/test/java/org/springframework/data/util/ClassTypeInformationUnitTests.java index 83169819c..5f9e42b5f 100644 --- a/src/test/java/org/springframework/data/util/ClassTypeInformationUnitTests.java +++ b/src/test/java/org/springframework/data/util/ClassTypeInformationUnitTests.java @@ -355,6 +355,7 @@ public class ClassTypeInformationUnitTests { /** * @see DATACMNS-783 + * @see DATACMNS-853 */ @Test public void specializesTypeUsingTypeVariableContext() { @@ -366,6 +367,7 @@ public class ClassTypeInformationUnitTests { assertThat(specialized.getType(), is((Object) Bar.class)); assertThat(specialized.getProperty("field").getType(), is((Object) Character.class)); + assertThat(specialized.getProperty("anotherField").getType(), is((Object) Integer.class)); } /** @@ -575,16 +577,17 @@ public class ClassTypeInformationUnitTests { static class Leaf {} - static class TypeWithAbstractGenericType { - AbstractBar abstractBar; + static class TypeWithAbstractGenericType { + AbstractBar abstractBar; Object object; } - static class Foo extends TypeWithAbstractGenericType {} + static class Foo extends TypeWithAbstractGenericType {} - static abstract class AbstractBar {} + static abstract class AbstractBar {} - static class Bar extends AbstractBar { + static class Bar extends AbstractBar { T field; + S anotherField; } }