You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Wes Wannemacher (JIRA)" <ji...@apache.org> on 2009/06/18 15:11:43 UTC
[jira] Commented: (WW-3162) Support @ParentPackage inheritance
[ https://issues.apache.org/struts/browse/WW-3162?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46392#action_46392 ]
Wes Wannemacher commented on WW-3162:
-------------------------------------
Looking through the code, I think it was intended to do so, if you look at the source for AnnotationTools.findAnnotation -
public static <T extends Annotation> T findAnnotation(Class<?> klass, Class<T> annotationClass) {
T ann = klass.getAnnotation(annotationClass);
while (ann == null && klass != null) {
ann = klass.getAnnotation(annotationClass);
if (ann == null)
ann = klass.getPackage().getAnnotation(annotationClass);
if (ann == null) {
--> klass = klass.getSuperclass();
}
}
return ann;
}
Where I put the arrow seems like a bug. The super class is gotten, but 'ann' is not assigned. I will make the change and hopefully you'll have a fix by 2.1.7, but since it changes behavior, there may be objections.
> Support @ParentPackage inheritance
> ----------------------------------
>
> Key: WW-3162
> URL: https://issues.apache.org/struts/browse/WW-3162
> Project: Struts 2
> Issue Type: New Feature
> Components: Plugin - Convention
> Affects Versions: 2.1.7
> Reporter: Chunyang, Wang
>
> I want to declare an annotation @ParentPackage("app-secure") in supper class, such as BaseSecureAction, so that the sub-classes can use thes ParentPackage and can override ParentPackage if the sub class declare its own one.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.