Announcement Announcement Module
Collapse
No announcement yet.
equals of intercepted and not intercepted objects - Cglib2AopProxy.EqualsInterceptor Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • equals of intercepted and not intercepted objects - Cglib2AopProxy.EqualsInterceptor

    Hi,

    Cglib2AopProxy.EqualsInterceptor implementation does not seem logical to me.

    If I have have intercepted object lets say io1 and not intercepted object lets say o2 and o2.equals(io1) is true. The problem is that io1.equals(o2) returns false! I would expect this to just proxy the call of equals to the real object. Anybody has a clue why is Cglib2AopProxy.EqualsInterceptor not implemented in this way?

    My setting:

    <bean id="loginBean" class="uk.co.cpwplc.portal.global.bean.LoginBean" scope="session">
    <aop:scoped-proxy/>
    </bean>

    <bean id="sampleLogin1" class="uk.co.cpwplc.portal.global.bean.LoginBean"/>

    and this is my implementation of equals:
    public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || !(o instanceof LoginBean)) return false;
    final LoginBean loginBean = (LoginBean) o;
    //do the comparison if properties, if not equal retrurn false
    return true;
    }

    With this setting sampleLogin1.equals(loginBean) returns true, but loginBean.equals(sampleLogin1) return false! Only workaround I found is to set the equals method as final, however this is not very nice!

    All comments are welcomed.

    Jiri

  • #2
    Are there any plans to fix it for version 3.0?

    Comment


    • #3
      Any updates on this thread?

      Comment


      • #4
        Solution

        Please see the solution posted here:

        http://forum.springsource.org/showthread.php?t=14767


        Thanks,
        Danny.

        Comment

        Working...
        X