From 17cf465d239605632fee99d8c869ea5fd0bee14c Mon Sep 17 00:00:00 2001 From: Chris Beams Date: Mon, 23 Jan 2012 11:15:13 +0100 Subject: [PATCH] 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 --- .../main/java/org/springframework/beans/ExtendedBeanInfo.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 1b63f37a3d..205cae1c17 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 @@ -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());