[weld-issues] [JBoss JIRA] Commented: (WELD-301) ProducerMethod.checkProducerMethod only checked method declarations in direct implemented interface and not super interfaces

Hong Zhang (JIRA) jira-events at lists.jboss.org
Sat Nov 21 12:58:29 EST 2009


    [ https://jira.jboss.org/jira/browse/WELD-301?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12495943#action_12495943 ] 

Hong Zhang commented on WELD-301:
---------------------------------

 When I traced the code, in this for loop: 

for (Type type : getDeclaringBean().getTypes())

returns two classes: the direct interface LightYellowPearTreeLocal and the java.lang.Object. But I think we need to get to all the super interfaces/classes as well. For example, the glassfish code, when trying to find all the classes in the class hierarchy uses the following code snippet: 

       Class parent = clazz;
        while ((parent = parent.getSuperclass()) != null) {
            if (parent.getPackage() == null ||
                    !parent.getPackage().getName().startsWith("java.lang")) {
                    classes.add(0, parent);
            }
        }

Basically the code needs to make sure classes like PearTreeLocal which is the super interface of the  LightYellowPearTreeLocal get examined in the for loop when looking for the declared method.

> ProducerMethod.checkProducerMethod only checked method declarations in direct implemented interface and not super interfaces
> ----------------------------------------------------------------------------------------------------------------------------
>
>                 Key: WELD-301
>                 URL: https://jira.jboss.org/jira/browse/WELD-301
>             Project: Weld
>          Issue Type: Bug
>    Affects Versions: 1.0.0.GA
>         Environment: X86/Ubuntu
>            Reporter: Hong Zhang
>            Priority: Critical
>
> I am investigating the deployment failure when running org.jboss.jsr299.tck.tests.implementation.producer.method.definition.enterprise.EnterpriseProducerMethodDefinitionTest.
> The deployment failed due to some validation failure in weld RI code. It complains that produceLightYellowPear method of LightYellowPearTree is not declared in LightYellowPearTree business interface. But LightYellowTree implements LightYellowPearTreeLocal which extends from PearTreeLocal which delares the produceLightYellowPear method.
> This seems a weld RI bug to me after stepping into the RI code:
> In ProducerMethod.checkProducerMethod, when it's a session bean, it will check for its implemented interface and super class for whether they declared this business method. But the problem is it only goes to its direct implemented interface and not the interface hierarchy. In this case it's true that the LightYellowPearTreeLocal does not declare this method, but PearTreeLocal which the LightYellowPearTreeLocal extends from does declare this method. The RI code should be modified to check for the whole interface hierarchy and not just the direct implemented interface.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the weld-issues mailing list