You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Musachy Barroso (JIRA)" <ji...@apache.org> on 2009/04/12 20:20:06 UTC

[jira] Resolved: (WW-3083) Certain annotations should not only be inherited from their super class package but also from their super class itself

     [ https://issues.apache.org/struts/browse/WW-3083?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Musachy Barroso resolved WW-3083.
---------------------------------

    Resolution: Fixed

Good catch. I used your second suggestion, and added some tests. I went for the second option because any annotation that can be applied to the package level, and the action level, should follow the same rules:

#1 try to find the annotation in the class
#2 try to find the annotation in the package
#3 move up in the class hierarchy and go to #1

thanks for reporting.

> Certain annotations should not only be inherited from their super class package but also from their super class itself
> ----------------------------------------------------------------------------------------------------------------------
>
>                 Key: WW-3083
>                 URL: https://issues.apache.org/struts/browse/WW-3083
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - Convention
>    Affects Versions: 2.1.6
>            Reporter: Kris Coolsaet
>            Priority: Minor
>             Fix For: 2.1.7
>
>
> The API documentation of AnnotationTools.findAnnotation expected me to think that  annotation were inherited.
> Example: assume mypackage.MyAction extends otherpackage.SuperAction
> If MyAction does not have a @ParentPackage annotation and SuperAction does, then I had expected that the parent package of SuperAction would also be used for MyAction. This is not the case. However, if the package-info.java of otherpackage has a @ParentPackage annotation (and mypackage does not) then that annotation is used also for MyAction. This distinction between classes and the packages they belong to, feels counterintuitive.
> Apart from @ParentPackage, other annotations might benifit from inheritance as well, e.g., @InterceptorRef.
> There are two ways to implement this requested behavior: add and @Inherited (meta-)annotation to the annotations, or reimplement AnnotationTools.findAnnotation to also look at the annotations of the super class. (The latter solution would however not distinguish between different types of annotation.)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.