Closed Bug 775566 Opened 12 years ago Closed 12 years ago

JavaAdapter + java.util.Timer regression

Categories

(Rhino Graveyard :: Core, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: nickolay8, Unassigned)

Details

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:14.0) Gecko/20100101 Firefox/14.0.1
Build ID: 20120714012003

Steps to reproduce:

In Rhino 1.7 release 2 2010 01 20 this code works fine:

var timer               = new java.util.Timer()
var task    = new JavaAdapter(java.util.TimerTask, { run : function () { print("YO") } }) 
timer.schedule(task, 2000)

In Rhino 1.7 release 4 2012 06 18 same code throws exception:

js> org.mozilla.javascript.WrappedException: Wrapped java.lang.NoSuchMethodException: adapter1.<init>(org.mozilla.javascript.Scriptable, org.mozilla.javascript.ContextFactory)
        at org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Context.java:1754)
        at org.mozilla.javascript.JavaAdapter.js_createAdapter(JavaAdapter.java:222)
        at org.mozilla.javascript.JavaAdapter.execIdCall(JavaAdapter.java:86)
        at org.mozilla.javascript.IdFunctionObject.call(IdFunctionObject.java:97)
        at org.mozilla.javascript.BaseFunction.construct(BaseFunction.java:343)
        at org.mozilla.javascript.ScriptRuntime.newObject(ScriptRuntime.java:2349)
        at org.mozilla.javascript.gen._stdin__2._c_script_0(Unknown Source)
        at org.mozilla.javascript.gen._stdin__2.call(Unknown Source)
        at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:394)
        at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3091)
        at org.mozilla.javascript.gen._stdin__2.call(Unknown Source)
        at org.mozilla.javascript.gen._stdin__2.exec(Unknown Source)
        at org.mozilla.javascript.tools.shell.Main.processSource(Main.java:502)
        at org.mozilla.javascript.tools.shell.Main.processFiles(Main.java:178)
        at org.mozilla.javascript.tools.shell.Main$IProxy.run(Main.java:102)
        at org.mozilla.javascript.Context.call(Context.java:489)
        at org.mozilla.javascript.ContextFactory.call(ContextFactory.java:504)
        at org.mozilla.javascript.tools.shell.Main.exec(Main.java:160)
        at org.mozilla.javascript.tools.shell.Main.main(Main.java:138)
Caused by: java.lang.NoSuchMethodException: adapter1.<init>(org.mozilla.javascript.Scriptable, org.mozilla.javascript.ContextFactory)
        at java.lang.Class.getConstructor0(Class.java:2706)
        at java.lang.Class.getConstructor(Class.java:1657)
        at org.mozilla.javascript.JavaAdapter.js_createAdapter(JavaAdapter.java:205)
        ... 17 more



Actual results:

Exception is thrown


Expected results:

Task should been executed after 2s delay
It seems to work fine in Rhino 1.7 release 3 2011 05 09 too
This is a known regression in 1.7R4 that has been fixed in git master. It is the main reason 1.7R5 will be released soon.
Status: UNCONFIRMED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
(In reply to Hannes Wallnoefer from comment #2)
> This is a known regression in 1.7R4 that has been fixed in git master. It is
> the main reason 1.7R5 will be released soon.

β€œSoon”?
Hi, for everybody who is too lazy/stupid, I compiled it for you:

Download it here: http://killtube.org/downloads/rhino1_7R5pre/js.jar

All I did was:

git clone https://github.com/mozilla/rhino.git
cd rhino/
ant compile
ant jar

Have fun JavaScripting!
It’s not about being lazy or stupid, it’s about having an official release out there.
Rhino is dead, the last official download is and was 1.74... so don't hold your breath.

The new **** is Nashorn for Java 8 for fast JavaScripting in Java.

Though Rhino is used on Platforms, where Java 8 is not supported, for example Android. Google has it's own Java-VM called Dalvik, supporting only Java 7.
You need to log in before you can comment on or make changes to this bug.