I ran into a curious behavior I either never knew, or forgot regarding access permissions
via reflection. In order for a method to be accessible via reflection without calling
setAccessible on the method, both the method and the class have to be public. A public
method in a non-public class cannot be accessed by the resulting java.lang.reflect.Method
object. It fails with an java.lang.IllegalAccessException like that shown on JBREFLECT-50.
I also show the required change to allow the ReflectMethodInfoImpl to determine when a
call to setAccessible is needed.
I'm going to need a new jboss-reflect release for the current work I'm doing on
JBAS-6285. Its the jdk platform mbeans that are instances of non-public classes
implementing a public interface that I cannot create valid ManagedObjects for because of
this issue. Can I do a 2.0.3.GA release to pickup this fix for inclusion into jbossas
5.1.x?
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4210527#...
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&a...