Browse Source

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: 0c0a563a24
3.1.x
Chris Beams 14 years ago
parent
commit
e70119733a
  1. 2
      org.springframework.beans/src/main/java/org/springframework/beans/ExtendedBeanInfo.java

2
org.springframework.beans/src/main/java/org/springframework/beans/ExtendedBeanInfo.java

@ -301,6 +301,7 @@ class ExtendedBeanInfo implements BeanInfo {
} }
} }
else { else {
pd.setWriteMethod(null);
pd.setReadMethod(readMethod); pd.setReadMethod(readMethod);
try { try {
pd.setWriteMethod(writeMethod); pd.setWriteMethod(writeMethod);
@ -310,6 +311,7 @@ class ExtendedBeanInfo implements BeanInfo {
// fall through -> add property descriptor as best we can // fall through -> add property descriptor as best we can
} }
if (pd instanceof IndexedPropertyDescriptor) { if (pd instanceof IndexedPropertyDescriptor) {
((IndexedPropertyDescriptor)pd).setIndexedWriteMethod(null);
((IndexedPropertyDescriptor)pd).setIndexedReadMethod(indexedReadMethod); ((IndexedPropertyDescriptor)pd).setIndexedReadMethod(indexedReadMethod);
try { try {
((IndexedPropertyDescriptor)pd).setIndexedWriteMethod(indexedWriteMethod); ((IndexedPropertyDescriptor)pd).setIndexedWriteMethod(indexedWriteMethod);

Loading…
Cancel
Save