From: <cg...@us...> - 2008-11-24 05:52:42
|
Revision: 5632 http://jython.svn.sourceforge.net/jython/?rev=5632&view=rev Author: cgroves Date: 2008-11-24 05:52:36 +0000 (Mon, 24 Nov 2008) Log Message: ----------- Reinstate the code from PyReflectedConstructor that redirectes to the proxy constructor whenever a Python subclass of a Java class attempts to call its Java-superclass constructor. PyJavaType can finally handle it. Modified Paths: -------------- branches/newstyle-java-types/src/org/python/core/PyReflectedConstructor.java Modified: branches/newstyle-java-types/src/org/python/core/PyReflectedConstructor.java =================================================================== --- branches/newstyle-java-types/src/org/python/core/PyReflectedConstructor.java 2008-11-24 05:37:21 UTC (rev 5631) +++ branches/newstyle-java-types/src/org/python/core/PyReflectedConstructor.java 2008-11-24 05:52:36 UTC (rev 5632) @@ -93,6 +93,13 @@ throw Py.TypeError("self invalid - must implement: " + declaringClass.getName()); } + // If the declaring class is a pure Java type but we're instantiating a Python proxy, + // grab the proxy version of the constructor to instantiate the proper type + if (!PyProxy.class.isAssignableFrom(declaringClass) + && !(self.getType() instanceof PyJavaType)) { + return PyType.fromClass(javaClass).lookup("__init__").__call__(self, args, keywords); + } + if (self.javaProxy != null) { Class<?> sup = javaClass; if (PyProxy.class.isAssignableFrom(sup)) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |