Permalink
Browse files

HV-573: Handling Void type correctly during unboxing

  • Loading branch information...
1 parent a3f6b33 commit 86b46d45c175c8e5be320340e4179a3e7d3ccacf @gunnarmorling committed Apr 13, 2012
Showing with 14 additions and 6 deletions.
  1. +14 −6 engine/src/main/java/org/hibernate/validator/internal/util/ReflectionHelper.java
@@ -684,12 +684,17 @@ public static boolean haveSameSignature(Method method1, Method method2) {
/**
* Returns the autoboxed type of a primitive type.
- *
- * @param primitiveType the primitive type
- *
- * @return the autoboxed type of a primitive type.
- *
- * @throws IllegalArgumentException in case the parameter {@code primitiveType} does not represent a primitive type.
+ *
+ * @param primitiveType
+ * the primitive type
+ *
+ * @return the autoboxed type of a primitive type. In case {@link Void} is
+ * passed (which is considered as primitive type by
+ * {@link Class#isPrimitive()}), {@link Void} will be returned.
+ *
+ * @throws IllegalArgumentException
+ * in case the parameter {@code primitiveType} does not
+ * represent a primitive type.
*/
public static Class<?> boxedType(Type primitiveType) {
if ( !( primitiveType instanceof Class ) && !( (Class<?>) primitiveType ).isPrimitive() ) {
@@ -720,6 +725,9 @@ else if ( primitiveType == short.class ) {
else if ( primitiveType == byte.class ) {
return Byte.class;
}
+ else if ( primitiveType == Void.TYPE ) {
+ return Void.TYPE;
+ }
else {
throw log.getUnhandledPrimitiveTypeException();
}

0 comments on commit 86b46d4

Please sign in to comment.