#1804 - Kotlin: Generating collection with wildcard type - Get error BeanNotRegisteredException: Error with association to [null] from [...Foo.manyProperty]. Is null registered?

This commit is contained in:
rob bygrave
2019-08-25 15:58:46 +12:00
parent be66872249
commit 0e65efea57
4 changed files with 153 additions and 1 deletions
@@ -313,10 +313,17 @@ public class DeployCreateProperties {
Type[] typeArgs = ptype.getActualTypeArguments();
if (typeArgs.length == 1) {
// probably a Set or List
// expecting set or list
if (typeArgs[0] instanceof Class<?>) {
return (Class<?>) typeArgs[0];
}
if (typeArgs[0] instanceof WildcardType) {
final Type[] upperBounds = ((WildcardType) typeArgs[0]).getUpperBounds();
if (upperBounds.length == 1 && upperBounds[0] instanceof Class<?>) {
// kotlin generated wildcard type
return (Class<?>) upperBounds[0];
}
}
// throw new RuntimeException("Unexpected Parameterised Type? "+typeArgs[0]);
return null;
}