Import ConstructorResolver to handle null values
Previously, ConstructorResolver would reject any candidate if the parameter is `null`. The reason for that is that null does not carry any type and the matching algorithm would systematically fail for that argument. This commit adds an extra check, and several tests, to validate that a null value is taken into account. Closes gh-31495
This commit is contained in:
@@ -1200,7 +1200,8 @@ class ConstructorResolver {
|
||||
}
|
||||
|
||||
private Predicate<ResolvableType> isAssignable(ResolvableType valueType) {
|
||||
return parameterType -> parameterType.isAssignableFrom(valueType);
|
||||
return parameterType -> (valueType == ResolvableType.NONE
|
||||
|| parameterType.isAssignableFrom(valueType));
|
||||
}
|
||||
|
||||
private ResolvableType extractElementType(ResolvableType parameterType) {
|
||||
|
||||
Reference in New Issue
Block a user