TypeDescriptor properly narrows ResolvableType for non-typed collection elements

Issue: SPR-14971
(cherry picked from commit 442d8a6)
This commit is contained in:
Juergen Hoeller
2016-12-12 22:28:48 +01:00
parent 2de488e7f5
commit bcdda917e7
2 changed files with 28 additions and 3 deletions

View File

@@ -191,7 +191,7 @@ public class TypeDescriptor implements Serializable {
return this;
}
ResolvableType narrowed = ResolvableType.forType(value.getClass(), this.resolvableType);
return new TypeDescriptor(narrowed, null, this.annotations);
return new TypeDescriptor(narrowed, value.getClass(), this.annotations);
}
/**
@@ -445,7 +445,10 @@ public class TypeDescriptor implements Serializable {
if (typeDescriptor != null) {
return typeDescriptor.narrow(value);
}
return (value != null ? new TypeDescriptor(this.resolvableType, value.getClass(), this.annotations) : null);
if (value != null) {
return narrow(value);
}
return null;
}
@Override