Author: wesw
Date: Thu Jun 18 13:21:57 2009
New Revision: 786050
URL: http://svn.apache.org/viewvc?rev=786050&view=rev
Log:
WW-3162, properly supporting inheritance for ParentPackage annotation
Modified:
struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/annotation/AnnotationTools.java
Modified:
struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/annotation/AnnotationTools.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/annotation/AnnotationTools.java?rev=786050&r1=786049&r2=786050&view=diff
==============================================================================
---
struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/annotation/AnnotationTools.java
(original)
+++
struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/annotation/AnnotationTools.java
Thu Jun 18 13:21:57 2009
@@ -31,7 +31,7 @@
/**
* 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 @@
ann = klass.getPackage().getAnnotation(annotationClass);
if (ann == null) {
klass = klass.getSuperclass();
+ if (klass != null ) {
+ ann = klass.getAnnotation(annotationClass);
+ }
}
}
return ann;
}
-}
\ No newline at end of file
+}