Consider Void.class a primitive wrapper in ClassUtils
Prior to this commit, ClassUtils.isPrimitiveOrWrapper() and ClassUtils.isPrimitiveWrapper() did not return true for Void.class. However, ClassUtils.isPrimitiveOrWrapper() did return true for void.class. This lacking symmetry is inconsistent and can lead to bugs in reflective code. See: https://github.com/spring-projects/spring-data-r2dbc/issues/159 This commit addresses this by adding an entry for Void.class -> void.class in the internal primitiveWrapperTypeMap in ClassUtils. Closes gh-23572
This commit is contained in:
@@ -114,7 +114,12 @@ public class ViewResolutionResultHandlerTests {
|
||||
private void testSupports(MethodParameter returnType, boolean supports) {
|
||||
ViewResolutionResultHandler resultHandler = resultHandler(mock(ViewResolver.class));
|
||||
HandlerResult handlerResult = new HandlerResult(new Object(), null, returnType, this.bindingContext);
|
||||
assertEquals(supports, resultHandler.supports(handlerResult));
|
||||
if (supports) {
|
||||
assertTrue("return type [" + returnType + "] should be supported", resultHandler.supports(handlerResult));
|
||||
}
|
||||
else {
|
||||
assertFalse("return type [" + returnType + "] should not be supported", resultHandler.supports(handlerResult));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user