WW-3162, properly supporting inheritance for ParentPackage annotation

git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@786050 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Wesley Wannemacher
2009-06-18 13:21:57 +00:00
parent 4e8bd6f09b
commit d8e5ea68d9
@@ -31,7 +31,7 @@ public class AnnotationTools {
/**
* Returns the annotation on the given class or the package of the class. This searchs up the
* class hierarchy and the package hierarchy.
* class hierarchy and the package hierarchy for the closest match.
*
* @param klass The class to search for the annotation.
* @param annotationClass The Class of the annotation.
@@ -45,9 +45,12 @@ public class AnnotationTools {
ann = klass.getPackage().getAnnotation(annotationClass);
if (ann == null) {
klass = klass.getSuperclass();
if (klass != null ) {
ann = klass.getAnnotation(annotationClass);
}
}
}
return ann;
}
}
}