Issue1393

classification
Title: TypeError: _new_impl(): expected 1 args; got 0
Type: behaviour Severity: normal
Components: Core Versions: 2.5.1
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: cgroves Nosy List: cgroves, thijs
Priority: Keywords:

Created on 2009-07-02.18:24:23 by thijs, last changed 2009-08-26.19:33:14 by thijs.

Files
File name Uploaded Description Edit Remove
jython_flash.py thijs, 2009-07-02.18:24:21
Messages
msg4873 (view) Author: Thijs Triemstra (thijs) Date: 2009-07-02.18:24:21
When trying to implement this example from 
http://djproject.cvs.sourceforge.net/*checkout*/djproject/DJNativeSwing-
SWTDemo/src/chrriis/dj/nativeswing/swtimpl/demo/examples/flashplayer/SimpleFlashExample.java?
pathrev=R-0_9_8, boiling down to:

JFlashPlayer flashPlayer = new JFlashPlayer();

in Jython 2.5.0 final:

flashPlayer = JFlashPlayer()

I'm getting this error:

$ jython jython_flash.py 
Traceback (most recent call last):
File "jython_flash.py", line 66, in <module>
app = AppGUI(title)
File "jython_flash.py", line 18, in __init__
self.create_gui()
File "jython_flash.py", line 35, in create_gui
flashPlayer = JFlashPlayer()
TypeError: _new_impl(): expected 1 args; got 0

I logged a ticket for the JFlashPlayer's library here:
http://sourceforge.net/tracker/?func=detail&aid=2809954&group_id=190690&atid=934370

But it looks like a Jython bug, because of the '_new_impl()'..

See attached sample program.
msg4874 (view) Author: Charlie Groves (cgroves) Date: 2009-07-02.22:04:22
This is a bad error message from Jython.  If you'll look at 
http://djproject.sourceforge.net/ns/documentation/javadoc/chrriis/dj/nat
iveswing/swtimpl/components/JFlashPlayer.html, JFlashPlayer takes vararg 
NSOptions in its constructor.  Jython can't tell the difference between 
varargs and an array in a constructor, so it's expecting you to pass an 
array in there.  I believe if you call JFlashPlayer([]), this will work 
in Jython.

I'm going to leave this open so I'll remember to improve the error 
handling on constructors and around varargs.
msg4875 (view) Author: Thijs Triemstra (thijs) Date: 2009-07-03.01:10:28
When I pass in [] it throws this error.. hmm

Traceback (most recent call last):
  File "jython_flash.py", line 58, in <module>
    app = SimpleFlashExample()
  File "jython_flash.py", line 21, in __init__
    flashPlayer = JFlashPlayer([])
	at javax.swing.ImageIcon.<init>(ImageIcon.java:167)
	at chrriis.dj.nativeswing.swtimpl.components.DefaultWebBrowserDecorator.createIcon(DefaultWebBrowserDecorator.java:529)
	at chrriis.dj.nativeswing.swtimpl.components.DefaultWebBrowserDecorator.access$7(DefaultWebBrowserDecorator.java:527)
	at 
chrriis.dj.nativeswing.swtimpl.components.DefaultWebBrowserDecorator$WebBrowserMenuBar.<init>(DefaultWebBrowserDecorator.java:244)
	at chrriis.dj.nativeswing.swtimpl.components.DefaultWebBrowserDecorator.<init>(DefaultWebBrowserDecorator.java:517)
	at chrriis.dj.nativeswing.swtimpl.components.JWebBrowser.createWebBrowserDecorator(JWebBrowser.java:97)
	at chrriis.dj.nativeswing.swtimpl.components.JWebBrowser.<init>(JWebBrowser.java:167)
	at chrriis.dj.nativeswing.swtimpl.components.JFlashPlayer.<init>(JFlashPlayer.java:126)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
	at org.python.core.PyReflectedConstructor.constructProxy(PyReflectedConstructor.java:163)

java.lang.NullPointerException: java.lang.NullPointerException
msg4876 (view) Author: Charlie Groves (cgroves) Date: 2009-07-03.01:54:54
I think that may be a problem with JFlashPlayer.  Could you try running 
equivalent Java code with the same JVM and libraries?
msg4980 (view) Author: Charlie Groves (cgroves) Date: 2009-08-02.23:53:30
As of r6626 passing the wrong number of arguments to a Java constructor 
prints out the name of the class instead of _new_impl.
msg5070 (view) Author: Thijs Triemstra (thijs) Date: 2009-08-26.19:33:13
Thanks that's better :)

Traceback (most recent call last):
  File "/Users/thijstriemstra/Downloads/jython_flash.py", line 58, in 
<module>
    app = SimpleFlashExample()
  File "/Users/thijstriemstra/Downloads/jython_flash.py", line 21, in 
__init__
    flashPlayer = JFlashPlayer()
TypeError: chrriis.dj.nativeswing.swtimpl.components.JFlashPlayer(): 
expected 1 args; got 0
History
Date User Action Args
2009-08-26 19:33:14thijssetmessages: + msg5070
2009-08-02 23:53:31cgrovessetstatus: open -> closed
resolution: fixed
messages: + msg4980
2009-07-03 01:54:54cgrovessetmessages: + msg4876
2009-07-03 01:10:29thijssetmessages: + msg4875
2009-07-02 22:04:23cgrovessetassignee: cgroves
messages: + msg4874
nosy: + cgroves
2009-07-02 18:24:24thijscreate