Fix method equality bug in ExtendedBeanInfo

A number of users reported issues with comparing method identity vs
equivalence when discovering JavaBeans property methods in
ExtendedBeanInfo.

This commit updates the implementation to consistently use '.equals()'
instead of '=='.

Issue: SPR-8079, SPR-8347
This commit is contained in:
Chris Beams
2012-01-23 11:15:13 +01:00
parent 010abd06e3
commit 17cf465d23

View File

@@ -170,8 +170,8 @@ class ExtendedBeanInfo implements BeanInfo {
continue ALL_METHODS;
}
}
if (method == pd.getReadMethod()
|| (pd instanceof IndexedPropertyDescriptor && method == ((IndexedPropertyDescriptor) pd).getIndexedReadMethod())) {
if (method.equals(pd.getReadMethod())
|| (pd instanceof IndexedPropertyDescriptor && method.equals(((IndexedPropertyDescriptor) pd).getIndexedReadMethod()))) {
// yes -> copy it, including corresponding setter method (if any -- may be null)
if (pd instanceof IndexedPropertyDescriptor) {
this.addOrUpdatePropertyDescriptor(pd, pd.getName(), pd.getReadMethod(), pd.getWriteMethod(), ((IndexedPropertyDescriptor)pd).getIndexedReadMethod(), ((IndexedPropertyDescriptor)pd).getIndexedWriteMethod());