-
Bug
-
Resolution: Unresolved
-
P3
-
8, 9
-
java.runtime.version=1.8.0-b132
Windows 7
-
Cause Known
Installed jdk-8-fcs-bin-b132-windows-x64-04_mar_2014 and tested my WebView integration in Java 8 and ran into an issue that doesn't exist in Java7.
Am using a callback class like this:
package com.xxx.yyy.webpane;
public abstract class Bridge {
public abstract Object executeMethod(String upcallMethod);
public abstract Object executeMethod(String upcallMethod, Object args);
}
The class is implemented @runtime using Rhino's mechanism to implement abstract classes:
var x = new Packages.com.xxx.yyy.webpane.Bridge({
executeMethod: function(methodName, args) {
//My logic here
}
})
Note: we use the standard Rhino, not the one that was bundled with Java7.
In Java 7 the above setup allowed me to call .executeMethod() with either 1 or 2 arguments and things would work fine.
In Java 8 it only works if I call .executeMethod() with 2 arguments and errors out when I call it with one argument. This will generate the following stacktrace:
java.lang.IllegalArgumentException: wrong number of arguments
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:71)
at sun.reflect.GeneratedMethodAccessor44.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:275)
at com.sun.webkit.Utilities$1.run(Utilities.java:75)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.webkit.Utilities.fwkInvokeWithContext(Utilities.java:72)
at com.sun.webkit.WebPage.twkProcessMouseEvent(Native Method)
at com.sun.webkit.WebPage.dispatchMouseEvent(WebPage.java:742)
at javafx.scene.web.WebView.processMouseEvent(WebView.java:1004)
at javafx.scene.web.WebView.access$2500(WebView.java:76)
at javafx.scene.web.WebView$14.handle(WebView.java:1130)
at javafx.scene.web.WebView$14.handle(WebView.java:1128)
at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
at javafx.event.Event.fireEvent(Event.java:204)
at javafx.scene.Scene$MouseHandler.process(Scene.java:3746)
at javafx.scene.Scene$MouseHandler.access$1800(Scene.java:3471)
at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1695)
at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2486)
at com.sun.javafx.tk.quantum.EmbeddedScene$2$1.run(EmbeddedScene.java:260)
at com.sun.javafx.tk.quantum.EmbeddedScene$2$1.run(EmbeddedScene.java:246)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.tk.quantum.EmbeddedScene$2.run(EmbeddedScene.java:246)
at com.sun.javafx.application.PlatformImpl$6$1.run(PlatformImpl.java:301)
at com.sun.javafx.application.PlatformImpl$6$1.run(PlatformImpl.java:298)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl$6.run(PlatformImpl.java:298)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.access$300(WinApplication.java:39)
at com.sun.glass.ui.win.WinApplication$4$1.run(WinApplication.java:112)
at java.lang.Thread.run(Thread.java:744)
ERROR java.lang.IllegalArgumentException: wrong number of arguments undefined:30 (onclick)
Am using a callback class like this:
package com.xxx.yyy.webpane;
public abstract class Bridge {
public abstract Object executeMethod(String upcallMethod);
public abstract Object executeMethod(String upcallMethod, Object args);
}
The class is implemented @runtime using Rhino's mechanism to implement abstract classes:
var x = new Packages.com.xxx.yyy.webpane.Bridge({
executeMethod: function(methodName, args) {
//My logic here
}
})
Note: we use the standard Rhino, not the one that was bundled with Java7.
In Java 7 the above setup allowed me to call .executeMethod() with either 1 or 2 arguments and things would work fine.
In Java 8 it only works if I call .executeMethod() with 2 arguments and errors out when I call it with one argument. This will generate the following stacktrace:
java.lang.IllegalArgumentException: wrong number of arguments
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:71)
at sun.reflect.GeneratedMethodAccessor44.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:275)
at com.sun.webkit.Utilities$1.run(Utilities.java:75)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.webkit.Utilities.fwkInvokeWithContext(Utilities.java:72)
at com.sun.webkit.WebPage.twkProcessMouseEvent(Native Method)
at com.sun.webkit.WebPage.dispatchMouseEvent(WebPage.java:742)
at javafx.scene.web.WebView.processMouseEvent(WebView.java:1004)
at javafx.scene.web.WebView.access$2500(WebView.java:76)
at javafx.scene.web.WebView$14.handle(WebView.java:1130)
at javafx.scene.web.WebView$14.handle(WebView.java:1128)
at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
at javafx.event.Event.fireEvent(Event.java:204)
at javafx.scene.Scene$MouseHandler.process(Scene.java:3746)
at javafx.scene.Scene$MouseHandler.access$1800(Scene.java:3471)
at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1695)
at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2486)
at com.sun.javafx.tk.quantum.EmbeddedScene$2$1.run(EmbeddedScene.java:260)
at com.sun.javafx.tk.quantum.EmbeddedScene$2$1.run(EmbeddedScene.java:246)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.tk.quantum.EmbeddedScene$2.run(EmbeddedScene.java:246)
at com.sun.javafx.application.PlatformImpl$6$1.run(PlatformImpl.java:301)
at com.sun.javafx.application.PlatformImpl$6$1.run(PlatformImpl.java:298)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl$6.run(PlatformImpl.java:298)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.access$300(WinApplication.java:39)
at com.sun.glass.ui.win.WinApplication$4$1.run(WinApplication.java:112)
at java.lang.Thread.run(Thread.java:744)
ERROR java.lang.IllegalArgumentException: wrong number of arguments undefined:30 (onclick)