jakarta-bsf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rony G. Flatscher" <Rony.Flatsc...@wu-wien.ac.at>
Subject Results of further investigations and a possible solution for Java 1.2, 1.3 and 1.4 (but not for 1.1 as of yet!) ... (Re: Problem on all Java versions (Re: Additional info (Re: Question on strange "java.lang.IllegalAccessException" in "EngineUtils.callBeanMethod(...)"
Date Thu, 13 Feb 2003 20:01:26 GMT
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!



View raw message