You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwebbeans.apache.org by st...@apache.org on 2011/07/11 01:10:35 UTC
svn commit: r1144984 -
/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/third/ThirdpartyBeanImpl.java
Author: struberg
Date: Sun Jul 10 23:10:35 2011
New Revision: 1144984
URL: http://svn.apache.org/viewvc?rev=1144984&view=rev
Log:
OWB-590 give ThirdpartyBeans a distinct hashCode and equals
This fixes an ugly bug because up till now it used the hashCode method
from AbstractOwbBean which was the same for all ThirdpartyBean instances...
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/third/ThirdpartyBeanImpl.java
Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/third/ThirdpartyBeanImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/third/ThirdpartyBeanImpl.java?rev=1144984&r1=1144983&r2=1144984&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/third/ThirdpartyBeanImpl.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/third/ThirdpartyBeanImpl.java Sun Jul 10 23:10:35 2011
@@ -179,4 +179,26 @@ public class ThirdpartyBeanImpl<T> exten
return false;
}
+ /**
+ * We need to override the hash code from the AbstractOwbBean
+ * and delegate to the shaded instance.
+ *
+ * @return the hash mixed with the shadowed bean.
+ */
+ @Override
+ public int hashCode()
+ {
+ return 29 * this.bean.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object other)
+ {
+ if (other instanceof ThirdpartyBeanImpl)
+ {
+ return ((ThirdpartyBeanImpl) other).bean.equals(bean);
+ }
+
+ return bean.equals(other);
+ }
}