1. portletspec3

Issue in GenericPortlet Annotation Processing



      This problem is a bit esoteric, and I hope I can adequately present it.
      It has to do with Action dispatching using annotations in the case of inheritance.

      Working Document 3 (22.04.13) Section "PLT. Action Dispatching", beginning at line 8
      on page 48, it states:
      For a received action the processAction method in the GenericPortlet class tries
      to dispatch to public methods annotated with the tag
      @ProcessAction(name=<action name>), where the action name must be set on the
      ActionURL ...

      An attempt was made to use this feature in the following manner:
      class PortletA extends GenericPortlet {
      void processMyActionAinA(ActionRequest req, ActionResponse resp)
      throws PortletException, java.io.IOException;

      class PortletB extends PortletA

      { @ProcessAction(name="actionA") void processMyActionAinB(ActionRequest req, ActionResponse resp) throws PortletException, java.io.IOException;}


      Now the question is, for portlet B, which "processMyActionA" is called when actionA occurs?

      We would want it to be "processMyActionAinB", I believe.

      However, GenericPortlet uses .getClass().getMethods() to obtain the methods for annotation processing.

      The javadoc for Class.getMethods() states:
      Returns an array containing Method objects reflecting all the public member methods of the
      class or interface represented by this Class object, including those declared by the class
      or interface and those inherited from superclasses and superinterfaces. Array classes
      return all the (public) member methods inherited from the Object class. The elements in the
      array returned are not sorted and are not in any particular order.

      Since GenericPortlet doesn't do any particular processing to handle methods inherited from
      superclasses, it turns out that the actual method for PortletB called when actionA occurs
      is not deterministic. It can be either "processMyActionAinB" or "processMyActionAinA", depending on
      how .getMethods() happens to order the method array.

      We may want to look into this at some point.



          • Assignee:
          • Votes:
            0 Vote for this issue
            0 Start watching this issue


            • Created: