Do not treat void and Void as simple types in BeanUtils

Prior to this commit, the isSimpleProperty() and isSimpleValueType()
methods in BeanUtils treated void and Void as simple types; however,
doing so does not make sense in this context, since void implies the
lack of a property or value.

This commit addresses this by explicitly excluding void and Void in the
logic in isSimpleValueType().

This commit also simplifies the implementation of
ViewResolutionResultHandler.supports(HandlerResult) to take advantage
of this change.

Closes gh-23573
This commit is contained in:
Sam Brannen
2019-09-04 15:48:40 +02:00
parent 3a132f8c3c
commit d036b5a283
3 changed files with 101 additions and 25 deletions

View File

@@ -160,9 +160,11 @@ public class ViewResolutionResultHandler extends HandlerResultHandlerSupport
type = result.getReturnType().getGeneric().toClass();
}
return (CharSequence.class.isAssignableFrom(type) || Rendering.class.isAssignableFrom(type) ||
Model.class.isAssignableFrom(type) || Map.class.isAssignableFrom(type) ||
Void.class.equals(type) || void.class.equals(type) || View.class.isAssignableFrom(type) ||
return (CharSequence.class.isAssignableFrom(type) ||
Rendering.class.isAssignableFrom(type) ||
Model.class.isAssignableFrom(type) ||
Map.class.isAssignableFrom(type) ||
View.class.isAssignableFrom(type) ||
!BeanUtils.isSimpleProperty(type));
}