Title: TypeError: _new_impl(): expected 1 args; got 0
Type: behaviour Severity: normal
Components: Core Versions: 2.5.1
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.

File name Uploaded Description Edit Remove thijs, 2009-07-02.18:24:21
msg4873 (view) Author: Thijs Triemstra (thijs) Date: 2009-07-02.18:24:21
When trying to implement this example from*checkout*/djproject/DJNativeSwing-
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 
Traceback (most recent call last):
File "", line 66, in <module>
app = AppGUI(title)
File "", line 18, in __init__
File "", 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:

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
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 "", line 58, in <module>
    app = SimpleFlashExample()
  File "", line 21, in __init__
    flashPlayer = JFlashPlayer([])
	at javax.swing.ImageIcon.<init>(
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(
	at java.lang.reflect.Constructor.newInstance(
	at org.python.core.PyReflectedConstructor.constructProxy(

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/", line 58, in 
    app = SimpleFlashExample()
  File "/Users/thijstriemstra/Downloads/", line 21, in 
    flashPlayer = JFlashPlayer()
expected 1 args; got 0
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