DATACMNS-594 - Fixed creation of type variable map to extend into detected bounds.

The initial setup of the type variable map now unfolds the detected types in the map to make sure we detect all type variables present in the current scope.

Added caching of component and map value TypeInformation instances to avoid repeated creation.
This commit is contained in:
Oliver Gierke
2014-11-14 16:34:31 +01:00
parent eac6fcaa8e
commit c5721cfc0c
5 changed files with 103 additions and 22 deletions

View File

@@ -341,6 +341,18 @@ public class ClassTypeInformationUnitTests {
assertThat(subSubType.getType(), is((Object) ConcreteSubSub.class));
}
/**
* @see DATACMNS-594
*/
@Test
public void considersGenericsOfTypeBounds() {
ClassTypeInformation<ConcreteRootIntermediate> customer = ClassTypeInformation.from(ConcreteRootIntermediate.class);
TypeInformation<?> leafType = customer.getProperty("intermediate.content.intermediate.content");
assertThat(leafType.getType(), is((Object) Leaf.class));
}
static class StringMapContainer extends MapContainer<String> {
}
@@ -495,4 +507,24 @@ public class ClassTypeInformationUnitTests {
static class ConcreteSubSub extends GenericSubSub {
String content;
}
// DATACMNS-594
static class Intermediate<T> {
T content;
}
static abstract class GenericRootIntermediate<T> {
Intermediate<T> intermediate;
}
static abstract class GenericInnerIntermediate<T> {
Intermediate<T> intermediate;
}
static class ConcreteRootIntermediate extends GenericRootIntermediate<ConcreteInnerIntermediate> {}
static class ConcreteInnerIntermediate extends GenericInnerIntermediate<Leaf> {}
static class Leaf {}
}