[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 10:22:27 EDT 2008
"adrian at jboss.org" wrote : Ok, I understand now. It's not an override.
|
| This isn't even really java since without a setAccessible() it's illegal. :-)
|
|
| | Sub sub = new Sub();
| | Method method = Super.class.getDeclaredMethod("doSomething");
| | // method.setAccessible(true);
| | method.invoke(sub);
| |
| | Exception in thread "main" java.lang.IllegalAccessException: Class Sub can not access a member of class Super with modifiers "private"
| | at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:65)
| | at java.lang.reflect.Method.invoke(Method.java:588)
| | at Sub.main(Sub.java:36)
| |
|
| I guess it's mitigated by the super class having to add the annotation
| that allows it?
Ehr... nope, not really. You're still thinking to cleanly. ;-)
"adrian at jboss.org" wrote : Since you don't need to setAccessible() to retrieve annotations from
| the private super method then I don't think we would be introducing a security
| hole by supporting it within the MDR (this prints null).
|
|
| | Method method = Super.class.getDeclaredMethod("doSomething");
| | //method.setAccessible(true);
| | System.out.println(method.getAnnotation(Inherited.class));
| |
|
| I'd say you're idea of a new Signature is probably the easiest way to resolve this.
|
| My concern would be whether AOP needs to also use annotations on the
| method during the invocation and so know to use this Signature?
Not right now, because the EJB3 container sets up a manual interceptor chain. In future this chain should also come from aop.xml, then it might become a problem.
Note that both web container & client container have so far been left out of scope.
Is there a Jira for the new method signature?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4170338#4170338
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4170338
More information about the jboss-dev-forums
mailing list