From e70119733a9e7804d4e546b6b74933c7c48151df Mon Sep 17 00:00:00 2001 From: Chris Beams Date: Tue, 9 Oct 2012 20:04:55 -0700 Subject: [PATCH] Avoid further 'type mismatch' errors in ExtendedBeanInfo This change fixes further cases under JDK 6 in which setting a bridged (e.g. String-returning) read method can conflict with an existing corresponding bridge write method that accepts an Object parameter. This appears to be a implementation difference between JDKs 6 and 7, where the JDK 6 Introspector adds bridge methods and JDK 7 does not. The solution here is to consistently null-out any existing write method before setting the read method. We were doing this elsewhere in ExtendedBeanInfo already, but these two changes make the approach consistent throuhout. Issue: SPR-8806 Backport-Commit: 0c0a563a241466813ccc8233195e35bfee369920 --- .../main/java/org/springframework/beans/ExtendedBeanInfo.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/org.springframework.beans/src/main/java/org/springframework/beans/ExtendedBeanInfo.java b/org.springframework.beans/src/main/java/org/springframework/beans/ExtendedBeanInfo.java index 01d812a874f..1e2b3c398b7 100644 --- a/org.springframework.beans/src/main/java/org/springframework/beans/ExtendedBeanInfo.java +++ b/org.springframework.beans/src/main/java/org/springframework/beans/ExtendedBeanInfo.java @@ -301,6 +301,7 @@ class ExtendedBeanInfo implements BeanInfo { } } else { + pd.setWriteMethod(null); pd.setReadMethod(readMethod); try { pd.setWriteMethod(writeMethod); @@ -310,6 +311,7 @@ class ExtendedBeanInfo implements BeanInfo { // fall through -> add property descriptor as best we can } if (pd instanceof IndexedPropertyDescriptor) { + ((IndexedPropertyDescriptor)pd).setIndexedWriteMethod(null); ((IndexedPropertyDescriptor)pd).setIndexedReadMethod(indexedReadMethod); try { ((IndexedPropertyDescriptor)pd).setIndexedWriteMethod(indexedWriteMethod);