Hi there,

not being satisfied with an unexpected behaviour (raising an IllegalAccessException) in "Method.invoke(...)" , I went after all of the docs, went thru the Java specification PDF from Sun and created a little pure-Java testcase to check the assumptions I arrived at.

Here's the quintessence: it seems that "Method.invoke(...)" behaves differently to the compiler if invoking public methods of inner classes! I regard this to be a bug which occurs for all of the tested Windows Java versions of Sun (from Java version 1.1 through 1.4). (Does anyone know, how one can file a bug report with Sun?)

Anyway, I found a solution which unfortunately does not work with Java 1.1: starting with 1.2 the class "Method" is a subclass of "AccessibleObject", which allows for setting the inocation such, that no access rights are checked. At the moment I am using that functionality in "EngineUtils" everytime I can determine that a method possesses the Modifier "public". (In order to do that in a safe way, it is also necessary to determine whether the code is running under version 1.1, in which case "AccessibleObject" is not available. To do so, at present I am using an anonymous static block in "EngineUtils" in which the System properties are used to determine the version of the JVM. If someone knows of a field or function in the BSF package where the Java version is already available, please let me know.)

So far testing that code with BSF 2.2 under Sun's Windows jdk1.2.2, jdk1.3.1_06, j2sdk1.4.1_01 allows the Rexx programs to flawlessly access public methods of inner classes. If someone has an idea, how I could achieve the same functionality if BSF is running under a JVM 1.1, I really would appreciate such hints!

Regards,

---rony




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to