From: <cg...@us...> - 2009-08-03 01:14:40
|
Revision: 6626 http://jython.svn.sourceforge.net/jython/?rev=6626&view=rev Author: cgroves Date: 2009-08-02 23:52:18 +0000 (Sun, 02 Aug 2009) Log Message: ----------- Use the Java class name instead of _new_impl for Java constructors. Fixes issue #1393 Modified Paths: -------------- trunk/jython/Lib/test/test_java_integration.py trunk/jython/src/org/python/core/PyJavaType.java Modified: trunk/jython/Lib/test/test_java_integration.py =================================================================== --- trunk/jython/Lib/test/test_java_integration.py 2009-08-02 21:30:31 UTC (rev 6625) +++ trunk/jython/Lib/test/test_java_integration.py 2009-08-02 23:52:18 UTC (rev 6626) @@ -36,6 +36,13 @@ def test_str_doesnt_coerce_to_int(self): self.assertRaises(TypeError, Date, '99-01-01', 1, 1) + def test_class_in_failed_constructor(self): + try: + Dimension(123, 456, 789) + except TypeError, exc: + self.failUnless("java.awt.Dimension" in exc.message) + + class BeanTest(unittest.TestCase): def test_shared_names(self): self.failUnless(callable(Vector.size), Modified: trunk/jython/src/org/python/core/PyJavaType.java =================================================================== --- trunk/jython/src/org/python/core/PyJavaType.java 2009-08-02 21:30:31 UTC (rev 6625) +++ trunk/jython/src/org/python/core/PyJavaType.java 2009-08-02 23:52:18 UTC (rev 6626) @@ -457,7 +457,7 @@ dict.__setitem__(prop.__name__, prop); } - final PyReflectedConstructor reflctr = new PyReflectedConstructor("_new_impl"); + final PyReflectedConstructor reflctr = new PyReflectedConstructor(name); Constructor<?>[] constructors; // No matter the security manager, trying to set the constructor on class to accessible // blows up @@ -475,8 +475,7 @@ } if (PyObject.class.isAssignableFrom(forClass)) { PyObject new_ = new PyNewWrapper(forClass, "__new__", -1, -1) { - - public PyObject new_impl(boolean init, + @Override public PyObject new_impl(boolean init, PyType subtype, PyObject[] args, String[] keywords) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |