Announcement Announcement Module
Collapse
No announcement yet.
Interfaces getting re-ordered on proxy creation Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Interfaces getting re-ordered on proxy creation

    version: 1.1.4

    I have the following config snippet:

    Code:
      <bean name="view" class="org.springframework.aop.framework.ProxyFactoryBean">
        <property name="singleton"><value>false</value></property>
        <property name="proxyInterfaces">
          <list>
            <value>A</value>
            <value>B</value>
          </list>
        </property>
        <property name="interceptorNames">
          <list>
            <value>CAdvisor</value>
          </list>
        </property>
      </bean>
    (note the "B" interface extends the interface "C" for CAdvisor)

    In my main code I get this bean and then call:

    Code:
    bean.setTargetSource&#40;targetSource&#41;;
    Where targetSource is like a SingletonTargetSource containing a implementation of interface "A".

    Sometimes (not always I think) when I instantiate a proxy the order of the interfaces returned (by calling proxy.getClass().getInterfaces()) is:

    B
    A
    C

    Not, A B C! I am not yet clear whether this is a defect in the JVM (1.4.2_07) or in the Class[] of interfaces passed in from JDKDynamicAOPProxy. Any thoughts or ideas on this?

    Cheers
    Steve

    Update: this does not appear to be a jvm problem. A call to target.getProxiedInterfaces returns a class[] containing the target class first, followed by the interfaces B, A, C

  • #2
    Ok, so I see the issue. In class "AdvisedSupport" all the advised interfaces are stored in a HashSet. This means that when the array of classes is created to send to proxy creation, the order of the interfaces is undefined.

    This is a problem as the order of interfaces is significant to Proxy. I will file a JIRA regarding this, but am unclear as to whether folks think this is a defect or an enhancement request. I think it's a defect.

    Update: filed under JIRA #SPR-688

    Comment

    Working...
    X