Uploaded image for project: 'XWork'
  1. XWork
  2. XW-267

Component Interceptor / DefaultComponentManager does not inspect superinterfaces

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.0.5
    • 1.1
    • Interceptors
    • None

    Description

      Currently the component interceptor (the DefaultComponentManager) looks at only the parent interfaces and does not walk up the interface hierarchy. So if I have an enabler interface E, which is extended by an interface I which in turn is implemented by a class C, the components infrastructure will not instantiate the class C at the appropriate point when the declared enabler interface is E. The issue is most likely with the following code in DefaultComponentManager

      ---- Current Code ----
      private void addAllInterfaces(Class clazz, List allInterfaces) {
      if (clazz == null)

      { return; }

      Class[] interfaces = clazz.getInterfaces();
      allInterfaces.addAll(Arrays.asList(interfaces));
      addAllInterfaces(clazz.getSuperclass(), allInterfaces);
      }

      What possibly needs to be done is (one may replace List by Set for optimization purposes)

      — Suggested Code ----

      private void addAllInterfaces(Class clazz, List allInterfaces) {
      if (clazz == null) { return; }

      Class[] interfaces = clazz.getInterfaces();
      allInterfaces.addAll(Arrays.asList(interfaces));
      addAllInterfaces(interfaces, allInterfaces);
      addAllInterfaces(clazz.getSuperclass(), allInterfaces);
      }

      private void addAllInterfaces(Class[] clazzes, List allInterfaces) {
      if (clazzes != null)
      {
      for(int i = 0 ; i < clazzes.length; i++)

      { addAllInterfaces(clazzes[i],allInterfaces); }

      }

      }

      Attachments

        Activity

          People

            plightbo Patrick Lightbody
            dnene Dhananjay Nene
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: