Kabir,
When I do what you suggested (which totally makes sense) I am still getting
null. Here is what I have been able to tell after downloading the
jboss-aop_1.5.0.GA source:
invocation.resolveAnnotation(Timer.class) jumps into
org.jboss.aop.joinpoint.MethodInvocation.resolveAnnotation(Class annotation).
Here is that method:public Object resolveAnnotation(Class annotation)
| | {
| | 1 Object val = super.resolveAnnotation(annotation);
| | 2 if (val != null) return val;
| | 3 if (getAdvisor() != null)
| | 4 {
| | 5 val = getAdvisor().resolveAnnotation(getMethod(), annotation);
| | 6 if (val != null) return val;
| | 7 }
| | 8 return null;
| | }
| Line 1 returns null therefore line 2 does nothing
| getAdvisor() in line 3 returns non null so that line 5 is executed
| Here is the code for org.jboss.aop.Advisor.resolveAnnotation(Method m,
Class annotation):public Object resolveAnnotation(Method m, Class annotation)
| | {
| | 01 if (metadataContext != null)
| | 02 {
| | 03 Object val = metadataContext.getAnnotation(m, annotation);
| | 04 if (val != null) return val;
| | 05 }
| | 06
| | 07 if (annotations.isDisabled(m,annotation))
| | 08 return null;
| | 09
| | 10 Object value = annotations.resolveAnnotation(m, annotation);
| | 11 if (value == null) value =
AnnotationElement.getVisibleAnnotation(m, annotation);
| | 12 return value;
| | }
| Interesting note: the "annotations" property on the Method object "m" that
is passed into this method is null
| Line 01 doesn't do anything because the metadataContext is null
| Line 07 doesn't do anything because no annotations are "disabled"
| Line 10 doesn't do anything because the "annotations" property on "m" is
null
| Line 11 is interesting. Because I am using JDK 1.5 it doesn't actually
invoke AnnotationElement.getVisibleAnnotation(m, annotation). Instead it
invokes Method.getAnnotation(Class annotationClass) which tries to get the
"declaredAnnotations" list, which is empty, so it does nothing
| therefore null is returned to
org.jboss.aop.joinpoint.MethodInvocation.resolveAnnotation(Class annotation)
which in turn returns null to invocation.resolveAnnotation(Timer.class)
|
|
| Is this expected behavior?
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3954448#3954448
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3954448
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user