Rhino: Problem in NativeJavaMethod
   Date:
        Tue, 14 Aug 2001 10:23:35 +0200
   From:
        felix.meschberger@day.com
     To:
        Norris Boyd <nboyd@atg.com>




Hi Norris,

While working with wrapped Java classes we discovered a problem in
NativeJavaMethod : If the public method to be called is part of a
non-public class, the Sun Java VM throws an IllegalAccessException. This
bug in the Sun VM has been reported as Bug 4071593 to Sun, but has not been
resolved since....

I implemented a circumvention, for which I provide you the patch. I quickly
tested it, and it seems to work.

Regards
Felix
This commit is contained in:
nboyd%atg.com 2001-08-17 14:29:48 +00:00
Родитель bfa13e5c17
Коммит c9ff8d7ef1
1 изменённых файлов: 6 добавлений и 0 удалений

Просмотреть файл

@ -225,6 +225,12 @@ public class NativeJavaMethod extends NativeFunction implements Function {
printDebug("Calling ", meth, args);
}
/**
* Due to a bug in Suns VM, public methods in private
* classes are not accessible by default (Sun Bug #4071593).
* We have to explicitly set the method accessible beforehand
*/
meth.setAccessible(true);
Object retval = meth.invoke(javaObject, args);
Class staticType = meth.getReturnType();