M
mike
Can some Java guru out there please explain this to me?
When using Method.invoke to call method m on an object of class Y, I
got an IllegalAccessException with the message 'Class X can not access
a member of class Y with modifiers "public"'
Class Y is a public class and its method m is a public method. I
verified the behavior with both Java 1.4.0 and Java 1.3.1. I thought
it was impossible to get an IllegalAccessException on a public method!
There's more: When I made the *constructor* of class Y public (it had
been package access), no exception was thrown and I was able to call
method m successfully using Method.invoke.
What sense does that make?
Thanks for any explanation you can give,
--Mike
When using Method.invoke to call method m on an object of class Y, I
got an IllegalAccessException with the message 'Class X can not access
a member of class Y with modifiers "public"'
Class Y is a public class and its method m is a public method. I
verified the behavior with both Java 1.4.0 and Java 1.3.1. I thought
it was impossible to get an IllegalAccessException on a public method!
There's more: When I made the *constructor* of class Y public (it had
been package access), no exception was thrown and I was able to call
method m successfully using Method.invoke.
What sense does that make?
Thanks for any explanation you can give,
--Mike