Browse Source

relaxed warning about ambiguous setters to only be logged in case of actual write access (SPR-6399)

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@2595 50f2f4bb-b051-0410-bef5-90022cba6387
pull/1/head
Juergen Hoeller 16 years ago
parent
commit
f20044126d
  1. 4
      org.springframework.beans/src/main/java/org/springframework/beans/BeanWrapperImpl.java
  2. 4
      org.springframework.beans/src/main/java/org/springframework/beans/GenericTypeAwarePropertyDescriptor.java

4
org.springframework.beans/src/main/java/org/springframework/beans/BeanWrapperImpl.java

@ -1060,7 +1060,9 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra @@ -1060,7 +1060,9 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
}
pv.getOriginalPropertyValue().conversionNecessary = (valueToApply != originalValue);
}
final Method writeMethod = pd.getWriteMethod();
final Method writeMethod = (pd instanceof GenericTypeAwarePropertyDescriptor ?
((GenericTypeAwarePropertyDescriptor) pd).getWriteMethodForActualAccess() :
pd.getWriteMethod());
if (!Modifier.isPublic(writeMethod.getDeclaringClass().getModifiers()) && !writeMethod.isAccessible()) {
if (System.getSecurityManager()!= null) {
AccessController.doPrivileged(new PrivilegedAction<Object>() {

4
org.springframework.beans/src/main/java/org/springframework/beans/GenericTypeAwarePropertyDescriptor.java

@ -100,6 +100,10 @@ class GenericTypeAwarePropertyDescriptor extends PropertyDescriptor { @@ -100,6 +100,10 @@ class GenericTypeAwarePropertyDescriptor extends PropertyDescriptor {
@Override
public Method getWriteMethod() {
return this.writeMethod;
}
public Method getWriteMethodForActualAccess() {
Set<Method> ambiguousCandidates = this.ambiguousWriteMethods;
if (ambiguousCandidates != null) {
this.ambiguousWriteMethods = null;

Loading…
Cancel
Save