Skip to content

Commit e701197

Browse files
committed
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: 0c0a563
1 parent 0824746 commit e701197

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@ private void addOrUpdatePropertyDescriptor(PropertyDescriptor pd, String propert
301301
}
302302
}
303303
else {
304+
pd.setWriteMethod(null);
304305
pd.setReadMethod(readMethod);
305306
try {
306307
pd.setWriteMethod(writeMethod);
@@ -310,6 +311,7 @@ private void addOrUpdatePropertyDescriptor(PropertyDescriptor pd, String propert
310311
// fall through -> add property descriptor as best we can
311312
}
312313
if (pd instanceof IndexedPropertyDescriptor) {
314+
((IndexedPropertyDescriptor)pd).setIndexedWriteMethod(null);
313315
((IndexedPropertyDescriptor)pd).setIndexedReadMethod(indexedReadMethod);
314316
try {
315317
((IndexedPropertyDescriptor)pd).setIndexedWriteMethod(indexedWriteMethod);

0 commit comments

Comments
 (0)