[jboss-dev-forums] [JBoss Microcontainer Development] - Re: ClassInfo::getAnnotations bug

flavia.rainone@jboss.com do-not-reply at jboss.com
Thu Oct 22 12:32:02 EDT 2009


"Ales" wrote : The fix for Managed could be:
  | * make @ManagementObject @Inherited
  | * check the whole hierarchy

I think there is a misunderstanding here. You said you wanted ClassInfo.getAnnotations to return only the declared annotations. I followed the nomenclature used on JDK, that says that declared annotations excludes inherited annotations. So, the way it is implemented now, it doesn't matter if @ManagementObject is inherited or not, because getAnnotations method is ignoring the inherited annotations.

Before we changed the getAnnotations implementation, this method was returning exactly all the annotations of that particular class plus the inherited ones, as it was delegating to Class<?>.getAnnotations. This was being tested and that's why I had to change the tests to make them pass with the new implementation.

"Ales" wrote : I still prefer the way JDK does it. :-)
So maybe we should revert the changes and add a getDeclaredAnnotations method to AnnotatedInfo, similar to java.lang.reflect.AnnotatedElement interface?

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4261763#4261763

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4261763



More information about the jboss-dev-forums mailing list