From: <cg...@us...> - 2008-12-31 22:55:23
|
Revision: 5821 http://jython.svn.sourceforge.net/jython/?rev=5821&view=rev Author: cgroves Date: 2008-12-31 21:38:23 +0000 (Wed, 31 Dec 2008) Log Message: ----------- Java class mros are static, so don't compute them and blow up when trying to make a Python resolution order out of them. An ant clean will be necessary after this commit to clear out the exposed version of PyJavaType. Modified Paths: -------------- trunk/jython/CoreExposed.includes trunk/jython/Lib/test/test_java_visibility.py trunk/jython/src/org/python/core/PyJavaType.java trunk/jython/src/org/python/core/PyType.java trunk/jython/src/org/python/core/adapter/ClassicPyObjectAdapter.java Modified: trunk/jython/CoreExposed.includes =================================================================== --- trunk/jython/CoreExposed.includes 2008-12-31 21:37:59 UTC (rev 5820) +++ trunk/jython/CoreExposed.includes 2008-12-31 21:38:23 UTC (rev 5821) @@ -20,7 +20,6 @@ org/python/core/PyFunction.class org/python/core/PyGenerator.class org/python/core/PyInteger.class -org/python/core/PyJavaType.class org/python/core/PyList.class org/python/core/PyLong.class org/python/core/PyMethod.class Modified: trunk/jython/Lib/test/test_java_visibility.py =================================================================== --- trunk/jython/Lib/test/test_java_visibility.py 2008-12-31 21:37:59 UTC (rev 5820) +++ trunk/jython/Lib/test/test_java_visibility.py 2008-12-31 21:38:23 UTC (rev 5821) @@ -141,6 +141,7 @@ self.assertEquals('java.util', HashMap.__module__) self.assertEquals(Class, HashMap.__class__) self.assertEquals(None, HashMap.__doc__) + self.assertEquals(list(HashMap.__mro__), HashMap.mro()) def test_python_methods(self): s = SomePyMethods() Modified: trunk/jython/src/org/python/core/PyJavaType.java =================================================================== --- trunk/jython/src/org/python/core/PyJavaType.java 2008-12-31 21:37:59 UTC (rev 5820) +++ trunk/jython/src/org/python/core/PyJavaType.java 2008-12-31 21:38:23 UTC (rev 5821) @@ -16,11 +16,9 @@ import org.python.core.util.StringUtil; import org.python.expose.ExposeAsSuperclass; -import org.python.expose.ExposedMethod; import org.python.expose.ExposedType; import org.python.util.Generic; -@ExposedType(name = "javatype") public class PyJavaType extends PyType { private final static Class<?>[] OO = {PyObject.class, PyObject.class}; @@ -37,14 +35,6 @@ super(TYPE == null ? fromClass(PyType.class) : TYPE); } - @ExposedMethod(defaults = "null") - final PyList javatype_mro(PyObject o) { - if (o == null) { - return new PyList(mro); - } - return new PyList(((PyJavaType)o).mro); - } - @Override public Class<?> getProxyType() { return PyObject.class.isAssignableFrom(underlying_class) ? null : underlying_class; @@ -62,6 +52,10 @@ return !(attr instanceof PyReflectedField || attr instanceof PyReflectedFunction); } + PyObject[] compute_mro() { + return mro; + } + @Override protected void init() { name = underlying_class.getName(); Modified: trunk/jython/src/org/python/core/PyType.java =================================================================== --- trunk/jython/src/org/python/core/PyType.java 2008-12-31 21:37:59 UTC (rev 5820) +++ trunk/jython/src/org/python/core/PyType.java 2008-12-31 21:38:23 UTC (rev 5821) @@ -691,7 +691,7 @@ return new PyList(((PyType)o).compute_mro()); } - final PyObject[] compute_mro() { + PyObject[] compute_mro() { PyObject[] bases = this.bases; int n = bases.length; for (int i = 0; i < n; i++) { Modified: trunk/jython/src/org/python/core/adapter/ClassicPyObjectAdapter.java =================================================================== --- trunk/jython/src/org/python/core/adapter/ClassicPyObjectAdapter.java 2008-12-31 21:37:59 UTC (rev 5820) +++ trunk/jython/src/org/python/core/adapter/ClassicPyObjectAdapter.java 2008-12-31 21:38:23 UTC (rev 5821) @@ -108,10 +108,10 @@ }); } - /** - * Always returns true as we just return new PyJavaInstance(o) if the - * adapters added to the superclass can't handle o. - */ + /** + * Always returns true as we just return new PyJavaInstance(o) if the adapters added to the + * superclass can't handle o. + */ public boolean canAdapt(Object o) { return true; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |