[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: MDR doesn't work on annotated privates

wolfc do-not-reply at jboss.com
Wed Aug 13 06:02:04 EDT 2008


"adrian at jboss.org" wrote : The idea is that eventually MDR will support loading annotations before the
  | class is loaded, e.g. for AOP using javassist in that case 
  | you can't use the Method as the key, you've got to use the "signature".
Got it, so putting ejb3 meta data bridge onto Method is wrong.
"adrian at jboss.org" wrote : Of course, people that use it at runtime can still use the Method.
  | 
  | Your problem is that there is no way to define @Inherited for a non-class Annotation.
  | http://java.sun.com/j2se/1.5.0/docs/api/java/lang/annotation/Inherited.html
  | 
  | Sub.class.getMethod("postConstruct").getAnnotation(PostConstruct.class) == null
  | is the correct behaviour absent some other semantic/hack
  | and therefore it should be the behaviour of the MetaData.
Ah, but 
Sub.class.getDeclaredMethod("postConstruct").getAnnotation(PostConstruct.class) != null
which is what I'm interested in.
"adrian at jboss.org" wrote : We could try to simulate this behaviour where you could configure
  | somewhere that @PostConstruct should do an @Inherited like behaviour
  | at the method level then make the 
  | AnnotatedElementMetaDataLoader 
  | do the extra work for those annotations.
Well in actuality AnnotatedElementMetaDataLoader already works as I would expect it: http://viewvc.jboss.org/cgi-bin/viewvc.cgi/jbossas?view=rev&revision=76978. But because of the semantics of MethodSignature it's luck and not design that drives this (JBMDR-28 being the four-leaf clover).
"adrian at jboss.org" wrote : I remember discussing this issue about 6 months ago?
  | e.g. whether it should also search interfaces (with the multiple inheritance
  | problem it would cause) but nothing came of the discussion.
I missed that one.

I think we need a DeclaredMethodSignature. That should also solve the interfaces issue. Then I can put ejb3 meta data bridge on that one.

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

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



More information about the jboss-dev-forums mailing list