[jboss-user] [JBoss AOP] - Re: IllegalAccessException using reflection on private field

kabir.khan@jboss.com do-not-reply at jboss.com
Fri May 25 08:59:00 EDT 2007


Hi there,

your fix looks fine, thank you! If you want to contribute would you mind adding some tests to test this case to the ReflectionTester? Once that is done, I can add your fix to the aop source tree. Otherwise it will take a bit longer since I then need to write the tests :-) I think what you have done will also affect private constructors being called by reflection, since they also get a wrapper method, so if you really want to help it would be great if you could look at that too. Funnily enough the ReflectionAspect was the first thing I worked on when I started contributing to JBoss AOP :-)

To check out aop source
svn co http://anonsvn.jboss.org/repos/jbossas/projects/aop/trunk/ jboss-aop

The reflection test lives under jboss-aop/aop/src/main/org/jboss/aop/reflection/

And it is configured under
jboss-aop/aop/src/resources/test/reflection/jboss-aop.xml

Let me know if you need more info about how to build/run the tests?

BTW things like 
m.setAccessible(true);
will not work if run under a security manager, and the aop tests are being run with a security manager enabled.

Take a look at the ReflectionAspect.SecurityAction class, which currently wraps calls to Class.getDeclaredFields() etc. when called with and without a security manager.

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

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



More information about the jboss-user mailing list