Skip to content

Commit 17cf465

Browse files
committed
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
1 parent 010abd0 commit 17cf465

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,8 @@ public ExtendedBeanInfo(BeanInfo delegate) throws IntrospectionException {
170170
continue ALL_METHODS;
171171
}
172172
}
173-
if (method == pd.getReadMethod()
174-
|| (pd instanceof IndexedPropertyDescriptor && method == ((IndexedPropertyDescriptor) pd).getIndexedReadMethod())) {
173+
if (method.equals(pd.getReadMethod())
174+
|| (pd instanceof IndexedPropertyDescriptor && method.equals(((IndexedPropertyDescriptor) pd).getIndexedReadMethod()))) {
175175
// yes -> copy it, including corresponding setter method (if any -- may be null)
176176
if (pd instanceof IndexedPropertyDescriptor) {
177177
this.addOrUpdatePropertyDescriptor(pd, pd.getName(), pd.getReadMethod(), pd.getWriteMethod(), ((IndexedPropertyDescriptor)pd).getIndexedReadMethod(), ((IndexedPropertyDescriptor)pd).getIndexedWriteMethod());

0 commit comments

Comments
 (0)