|
View:
New views
7 Messages
—
Rating Filter:
Alert me
|
|
|
VMBridge_jdk15 is used for JDK 1.4?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 _______________________________________________ dev-tech-js-engine mailing list dev-tech-js-engine@... https://lists.mozilla.org/listinfo/dev-tech-js-engine |
|
|
|
|
|
RE: VMBridge_jdk15 is used for JDK 1.4?Hello Norris,
just xperienced the issue reported by Juerg too. My fault, that I did not test my Rhino usage with 1.6R6 pre releases. I need to have Rhino running with JDK 1.4 ... > Too bad 1.6R6 is already out, but we can make that change for 1.7 or 1.6R6.1 if we need it. I would raise my hand for both, Rhino 1.7 and fix release for 1.6R6. ... I mean, JDK 1.5 is not defined to be a requirement for Rhino, or am I wrong here? BTW, I'm very happy to have Rhino not requiring JDK 1.5 :-) cu Merten -----Original Message----- From: dev-tech-js-engine-bounces@... [mailto:dev-tech-js-engine-bounces@...] On Behalf Of Norris Boyd Sent: Tuesday, August 07, 2007 3:54 AM To: dev-tech-js-engine@... Subject: Re: VMBridge_jdk15 is used for JDK 1.4? 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 |
|
|
Re: VMBridge_jdk15 is used for JDK 1.4?Instead of testing for java.version, I tend to use some more foolproof
approaches, like in this case I'd probably use this: try { java.lang.reflect.Method.class.getMethod("isVarArgs", (Class[])null); // if we get here, we're on at least 1.5 JRE } catch(NoSuchMethodException e) { // if we get here, we're on a pre-1.5 JRE } I think we definitely need to put out a bugfix release -- not being able to use Rhino on JDK 1.4 out of the box, needing people to manually remove a file from the JAR file is a major issue. Attila. On Tue, 07 Aug 2007 03:53:38 +0200, Norris Boyd <norrisboyd@...> wrote: > > 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 dev-tech-js-engine mailing list dev-tech-js-engine@... https://lists.mozilla.org/listinfo/dev-tech-js-engine |
|
|
Re: VMBridge_jdk15 is used for JDK 1.4?Hi Norris,
As far as I understand it, the various VMBridge classes are supposed to throw an exception if they don't work on a given JDK, so the code in VMBridge.makeInstance that is looping through the possible classes keeps trying others. For VMBridge_jdk15, this could be done by adding code that tries accessing isVarArgs in a method at the time of instantiation, e.g.: public VMBridge_jdk15() throws SecurityException, NoSuchMethodException { // Just try and see if we can access isVarArgs() on this constructor VMBridge_jdk15.class.getConstructor(new Class[] {}).isVarArgs(); } I added this to my class, it now works again on JDK 1.4. Jürg On 6 Aug 2007, at 21:53, Norris Boyd wrote: > 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: _______________________________________________ dev-tech-js-engine mailing list dev-tech-js-engine@... https://lists.mozilla.org/listinfo/dev-tech-js-engine |
|
|
|
|
|
RE: VMBridge_jdk15 is used for JDK 1.4?Hi Norris,
1.6R7pre works fine for me. Thanx! :-) cu Merten -----Original Message----- From: dev-tech-js-engine-bounces@... [mailto:dev-tech-js-engine-bounces@...] On Behalf Of Norris Boyd Sent: Wednesday, August 08, 2007 2:59 PM To: dev-tech-js-engine@... Subject: Re: VMBridge_jdk15 is used for JDK 1.4? Juerg Lehni wrote: > Hi Norris, > > As far as I understand it, the various VMBridge classes are supposed > to throw an exception if they don't work on a given JDK, so the code > in VMBridge.makeInstance that is looping through the possible classes > keeps trying others. For VMBridge_jdk15, this could be done by adding > code that tries accessing isVarArgs in a method at the time of > instantiation, e.g.: > > public VMBridge_jdk15() throws SecurityException, > NoSuchMethodException { > // Just try and see if we can access isVarArgs() on this constructor > VMBridge_jdk15.class.getConstructor(new Class[] {}).isVarArgs(); > } > > I added this to my class, it now works again on JDK 1.4. > > Jürg > > On 6 Aug 2007, at 21:53, Norris Boyd wrote: > > > 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: I created bug https://bugzilla.mozilla.org/show_bug.cgi?id=391349 and checked in your fix for it. I've posted a release candidate for 1.6R7 to ftp://ftp.mozilla.org/pub/mozilla.org/js/rhino1_6R7-candidate1.zip. Please try it out and make sure it addresses the problem. --N _______________________________________________ dev-tech-js-engine mailing list dev-tech-js-engine@... https://lists.mozilla.org/listinfo/dev-tech-js-engine _______________________________________________ dev-tech-js-engine mailing list dev-tech-js-engine@... https://lists.mozilla.org/listinfo/dev-tech-js-engine |
| Free embeddable forum powered by Nabble | Forum Help |