« Return to Thread: VMBridge_jdk15 is used for JDK 1.4?

Re: VMBridge_jdk15 is used for JDK 1.4?

by Norris Boyd-2 :: Rate this Message:

Reply to Author | View in Thread

On Aug 6, 10:33 am, Juerg Lehni <le...@...> wrote:

> I run into this problem today when runing Rhino on JDK 1.4 on Mac:
>
> java.lang.NoSuchMethodError: java.lang.reflect.Method.isVarArgs()Z
> at org.mozilla.javascript.jdk15.VMBridge_jdk15.isVarArgs
> (VMBridge_jdk15.java:48)
>
> It seems that VMBridge_jdk15 is used although I am on 1.4.
>
> Looking at VMBridge's code for deciding which one to use, I saw that
> it loops through these and tries to instantiate them:
>
> org.mozilla.javascript.VMBridge_custom
> org.mozilla.javascript.jdk15.VMBridge_jdk15
> org.mozilla.javascript.jdk13.VMBridge_jdk13
> org.mozilla.javascript.jdk11.VMBridge_jdk11
>
> And for some reason it seems to be able to instantiate VMBridge_jdk15
> on 1.4 and is happy.
>
> I then looked at VMBridge_jdk15 and did not see any condition that
> should prevent it from being able to do so. Or should the missing
> isVarArgs() be enough a reason for it to not load?
>
> Is it just me, or is this currently broken for 1.4?
>
> Jürg

I added VMBridge_jdk15 for Rhino 1.6R6, although I didn't write the
previous VMBridge instances. From reading the previous code, I thought
the intent was to allow people to edit the jar file to enable the code
to work on different VM versions:

[rhino16R6] /cygdrive/c/j2sdk1.4.2_14/bin/java -jar js.jar
Exception in thread "main" java.lang.NoSuchMethodError:
java.lang.reflect.Method.isVarArgs()Z
        at
org.mozilla.javascript.jdk15.VMBridge_jdk15.isVarArgs(VMBridge_jdk15.java:
48)
        at org.mozilla.javascript.MemberBox.init(MemberBox.java:79)
        at org.mozilla.javascript.MemberBox.<init>(MemberBox.java:67)
        at
org.mozilla.javascript.FunctionObject.<init>(FunctionObject.java:124)
        at
org.mozilla.javascript.ScriptableObject.defineFunctionProperties(ScriptableObject.java:
1415)
        at org.mozilla.javascript.tools.shell.Global.init(Global.java:
128)
        at org.mozilla.javascript.tools.shell.Global$1.run(Global.java:
98)
        at org.mozilla.javascript.Context.call(Context.java:577)
        at
org.mozilla.javascript.ContextFactory.call(ContextFactory.java:503)
        at org.mozilla.javascript.tools.shell.Global.init(Global.java:
95)
        at org.mozilla.javascript.tools.shell.Main.exec(Main.java:158)
        at org.mozilla.javascript.tools.shell.Main.main(Main.java:140)
[rhino16R6] cp js.jar js-jdk14.jar
[rhino16R6] zip -d js-jdk14.jar org/mozilla/javascript/jdk15/
VMBridge_jdk15.class
deleting: org/mozilla/javascript/jdk15/VMBridge_jdk15.class
[rhino16R6] /cygdrive/c/j2sdk1.4.2_14/bin/java -jar js-jdk14.jar
Rhino 1.6 release 6 2007 07 26
js>

It would be nicer to detect the current version of the JVM using
System.getProperty("java.version") and load the appropriate VMBridge
instance. Too bad 1.6R6 is already out, but we can make that change
for 1.7 or 1.6R6.1 if we need it.

--N

_______________________________________________
dev-tech-js-engine mailing list
dev-tech-js-engine@...
https://lists.mozilla.org/listinfo/dev-tech-js-engine

 « Return to Thread: VMBridge_jdk15 is used for JDK 1.4?