mirror of
https://github.com/apache/struts.git
synced 2026-08-11 01:27:14 +00:00
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:
+5
-2
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user