From f20044126df290b12de35d8b15ab4c2e73150bdf Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Mon, 7 Dec 2009 18:57:32 +0000 Subject: [PATCH] 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 --- .../main/java/org/springframework/beans/BeanWrapperImpl.java | 4 +++- .../beans/GenericTypeAwarePropertyDescriptor.java | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/org.springframework.beans/src/main/java/org/springframework/beans/BeanWrapperImpl.java b/org.springframework.beans/src/main/java/org/springframework/beans/BeanWrapperImpl.java index b6ab6458344..0fcc7febfc2 100644 --- a/org.springframework.beans/src/main/java/org/springframework/beans/BeanWrapperImpl.java +++ b/org.springframework.beans/src/main/java/org/springframework/beans/BeanWrapperImpl.java @@ -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() { diff --git a/org.springframework.beans/src/main/java/org/springframework/beans/GenericTypeAwarePropertyDescriptor.java b/org.springframework.beans/src/main/java/org/springframework/beans/GenericTypeAwarePropertyDescriptor.java index 404b3399d1e..50d48eb24f0 100644 --- a/org.springframework.beans/src/main/java/org/springframework/beans/GenericTypeAwarePropertyDescriptor.java +++ b/org.springframework.beans/src/main/java/org/springframework/beans/GenericTypeAwarePropertyDescriptor.java @@ -100,6 +100,10 @@ class GenericTypeAwarePropertyDescriptor extends PropertyDescriptor { @Override public Method getWriteMethod() { + return this.writeMethod; + } + + public Method getWriteMethodForActualAccess() { Set ambiguousCandidates = this.ambiguousWriteMethods; if (ambiguousCandidates != null) { this.ambiguousWriteMethods = null;