write method parameter type preferred over read method parameter type for property conversion (fixing regression; SPR-8964)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2011 the original author or authors.
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -13,6 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.core.convert;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
@@ -144,10 +145,7 @@ public final class Property {
|
||||
if (read == null && write == null) {
|
||||
throw new IllegalStateException("Property is neither readable nor writeable");
|
||||
}
|
||||
if (read != null && write != null && !write.getParameterType().isAssignableFrom(read.getParameterType())) {
|
||||
throw new IllegalStateException("Write parameter is not assignable from read parameter");
|
||||
}
|
||||
return read != null ? read : write;
|
||||
return (write != null ? write : read);
|
||||
}
|
||||
|
||||
private MethodParameter resolveReadMethodParameter() {
|
||||
|
||||
Reference in New Issue
Block a user