From: <cg...@us...> - 2008-11-10 03:56:50
|
Revision: 5566 http://jython.svn.sourceforge.net/jython/?rev=5566&view=rev Author: cgroves Date: 2008-11-10 03:56:44 +0000 (Mon, 10 Nov 2008) Log Message: ----------- Fill in Java inner classes Modified Paths: -------------- branches/newstyle-java-types/src/org/python/core/PyJavaType.java Modified: branches/newstyle-java-types/src/org/python/core/PyJavaType.java =================================================================== --- branches/newstyle-java-types/src/org/python/core/PyJavaType.java 2008-11-10 03:36:31 UTC (rev 5565) +++ branches/newstyle-java-types/src/org/python/core/PyJavaType.java 2008-11-10 03:56:44 UTC (rev 5566) @@ -151,6 +151,9 @@ dict.__setitem__("__init__", reflctr); } } + for (Class<?> inner : underlying_class.getClasses()) { + dict.__setitem__(inner.getSimpleName(), PyType.fromClass(inner)); + } if (ClassDictInit.class.isAssignableFrom(underlying_class) && underlying_class != ClassDictInit.class) { try { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cg...@us...> - 2008-11-24 05:37:25
|
Revision: 5631 http://jython.svn.sourceforge.net/jython/?rev=5631&view=rev Author: cgroves Date: 2008-11-24 05:37:21 +0000 (Mon, 24 Nov 2008) Log Message: ----------- Don't hork when exposing fields on an interface as it won't have a base class Modified Paths: -------------- branches/newstyle-java-types/src/org/python/core/PyJavaType.java Modified: branches/newstyle-java-types/src/org/python/core/PyJavaType.java =================================================================== --- branches/newstyle-java-types/src/org/python/core/PyJavaType.java 2008-11-24 05:02:01 UTC (rev 5630) +++ branches/newstyle-java-types/src/org/python/core/PyJavaType.java 2008-11-24 05:37:21 UTC (rev 5631) @@ -77,7 +77,7 @@ Field[] fields = underlying_class.getFields(); for (Field field : fields) { Class<?> declaring = field.getDeclaringClass(); - if (declaring != base && base.isAssignableFrom(declaring)) { + if (base == null || (declaring != base && base.isAssignableFrom(declaring))) { String fldname = field.getName(); int fldmods = field.getModifiers(); Class<?> fldtype = field.getType(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cg...@us...> - 2008-11-28 21:29:17
|
Revision: 5656 http://jython.svn.sourceforge.net/jython/?rev=5656&view=rev Author: cgroves Date: 2008-11-28 21:29:14 +0000 (Fri, 28 Nov 2008) Log Message: ----------- Simplify PyBeanProperty construction Modified Paths: -------------- branches/newstyle-java-types/src/org/python/core/PyJavaType.java Modified: branches/newstyle-java-types/src/org/python/core/PyJavaType.java =================================================================== --- branches/newstyle-java-types/src/org/python/core/PyJavaType.java 2008-11-28 21:10:39 UTC (rev 5655) +++ branches/newstyle-java-types/src/org/python/core/PyJavaType.java 2008-11-28 21:29:14 UTC (rev 5656) @@ -5,10 +5,8 @@ import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.Collection; -import java.util.HashMap; import java.util.List; import java.util.Map; - import org.python.core.util.StringUtil; import org.python.expose.ExposeAsSuperclass; import org.python.util.Generic; @@ -35,7 +33,7 @@ @Override protected void fillDict() { dict = new PyStringMap(); - Map<String, Object> propnames = new HashMap<String, Object>(); + Map<String, PyBeanProperty> props = Generic.map(); Class<?> base = underlying_class.getSuperclass(); Method[] methods = underlying_class.getMethods(); for (Method meth : methods) { @@ -53,14 +51,30 @@ if (!Modifier.isStatic(meth.getModifiers())) { // check for xxxX.* int n = meth.getParameterTypes().length; - if (methname.startsWith("get") && n == 0) { - propnames.put(methname.substring(3), "getter"); - } else if (methname.startsWith("is") && n == 0 + String name = null; + boolean get = true; + if (methname.startsWith("get") && methname.length() > 3 && n == 0) { + name = methname.substring(3); + } else if (methname.startsWith("is") && methname.length() > 2 && n == 0 && meth.getReturnType() == Boolean.TYPE) { - propnames.put(methname.substring(2), "getter"); - } else if (methname.startsWith("set") && n == 1) { - propnames.put(methname.substring(3), meth); + name = methname.substring(2); + } else if (methname.startsWith("set") && methname.length() > 3 && n == 1) { + name = methname.substring(3); + get = false; } + if (name != null) { + name = normalize_name(StringUtil.decapitalize(name)); + PyBeanProperty prop = props.get(name); + if (prop == null) { + prop = new PyBeanProperty(name, underlying_class, null, null); + props.put(name, prop); + } + if (get) { + prop.getMethod = meth; + } else { + prop.setMethod = meth; + } + } } } } @@ -99,41 +113,20 @@ } } } - for (String propname : propnames.keySet()) { - if (propname.equals("")) { + for (PyBeanProperty prop : props.values()) { + PyObject prev = dict.__finditem__(prop.__name__); + if (prev != null && (!(prev instanceof PyReflectedField) + || !Modifier.isStatic(((PyReflectedField)prev).field.getModifiers()))) { continue; } - String npropname = normalize_name(StringUtil.decapitalize(propname)); - PyObject prev = dict.__finditem__(npropname); - if (prev != null && (!(prev instanceof PyReflectedField) || - !Modifier.isStatic(((PyReflectedField)prev).field.getModifiers()))) { - continue; + if (prev != null) { + prop.field = ((PyReflectedField)prev).field; } - Method getter = null; - Method setter = null; - Class<?> proptype = null; - getter = get_non_static_method(underlying_class, "get" + propname); - if (getter == null) - getter = get_non_static_method(underlying_class, "is" + propname); - if (getter != null) { - proptype = getter.getReturnType(); - setter = get_non_static_method(underlying_class, "set" + propname, proptype); - } else { - Object o = propnames.get(propname); - if (o instanceof Method) { - setter = (Method)o; - proptype = setter.getParameterTypes()[0]; - } + if (prop.getMethod != null && prop.setMethod != null + && prop.getMethod.getReturnType() != prop.setMethod.getReturnType()) { + prop.setMethod = null; } - if (setter != null || getter != null) { - PyBeanProperty prop = new PyBeanProperty(npropname, proptype, getter, setter); - if (prev != null) { - prop.field = ((PyReflectedField)prev).field; - } - dict.__setitem__(npropname, prop); - } else { - // XXX error - } + dict.__setitem__(prop.__name__, prop); } Constructor<?>[] ctrs = underlying_class.getConstructors(); if (ctrs.length != 0) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cg...@us...> - 2008-11-28 21:54:18
|
Revision: 5657 http://jython.svn.sourceforge.net/jython/?rev=5657&view=rev Author: cgroves Date: 2008-11-28 21:53:04 +0000 (Fri, 28 Nov 2008) Log Message: ----------- More cleanup Modified Paths: -------------- branches/newstyle-java-types/src/org/python/core/PyJavaType.java Modified: branches/newstyle-java-types/src/org/python/core/PyJavaType.java =================================================================== --- branches/newstyle-java-types/src/org/python/core/PyJavaType.java 2008-11-28 21:29:14 UTC (rev 5656) +++ branches/newstyle-java-types/src/org/python/core/PyJavaType.java 2008-11-28 21:53:04 UTC (rev 5657) @@ -2,6 +2,7 @@ import java.lang.reflect.Constructor; import java.lang.reflect.Field; +import java.lang.reflect.Member; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.Collection; @@ -33,95 +34,103 @@ @Override protected void fillDict() { dict = new PyStringMap(); + Class<?> base = underlying_class.getSuperclass(); + + // Add methods and determine bean properties declared on this class Map<String, PyBeanProperty> props = Generic.map(); - Class<?> base = underlying_class.getSuperclass(); - Method[] methods = underlying_class.getMethods(); - for (Method meth : methods) { - Class<?> declaring = meth.getDeclaringClass(); - if (base == null || - (declaring != base && base.isAssignableFrom(declaring) && !ignore(meth))) { - String methname = meth.getName(); - String nmethname = normalize_name(methname); - PyReflectedFunction reflfunc = (PyReflectedFunction)dict.__finditem__(nmethname); - if (reflfunc == null) { - dict.__setitem__(nmethname, new PyReflectedFunction(meth)); - } else { - reflfunc.addMethod(meth); + for (Method meth : underlying_class.getMethods()) { + if (!declaredOnMember(base, meth) || ignore(meth)) { + continue; + } + String methname = meth.getName(); + String nmethname = normalize(methname); + PyReflectedFunction reflfunc = (PyReflectedFunction)dict.__finditem__(nmethname); + if (reflfunc == null) { + dict.__setitem__(nmethname, new PyReflectedFunction(meth)); + } else { + reflfunc.addMethod(meth); + } + if (!Modifier.isStatic(meth.getModifiers())) { + // check for xxxX.* + int n = meth.getParameterTypes().length; + String name = null; + boolean get = true; + if (methname.startsWith("get") && methname.length() > 3 && n == 0) { + name = methname.substring(3); + } else if (methname.startsWith("is") && methname.length() > 2 && n == 0 + && meth.getReturnType() == Boolean.TYPE) { + name = methname.substring(2); + } else if (methname.startsWith("set") && methname.length() > 3 && n == 1) { + name = methname.substring(3); + get = false; } - if (!Modifier.isStatic(meth.getModifiers())) { - // check for xxxX.* - int n = meth.getParameterTypes().length; - String name = null; - boolean get = true; - if (methname.startsWith("get") && methname.length() > 3 && n == 0) { - name = methname.substring(3); - } else if (methname.startsWith("is") && methname.length() > 2 && n == 0 - && meth.getReturnType() == Boolean.TYPE) { - name = methname.substring(2); - } else if (methname.startsWith("set") && methname.length() > 3 && n == 1) { - name = methname.substring(3); - get = false; + if (name != null) { + name = normalize(StringUtil.decapitalize(name)); + PyBeanProperty prop = props.get(name); + if (prop == null) { + prop = new PyBeanProperty(name, underlying_class, null, null); + props.put(name, prop); } - if (name != null) { - name = normalize_name(StringUtil.decapitalize(name)); - PyBeanProperty prop = props.get(name); - if (prop == null) { - prop = new PyBeanProperty(name, underlying_class, null, null); - props.put(name, prop); - } - if (get) { - prop.getMethod = meth; - } else { - prop.setMethod = meth; - } + if (get) { + prop.getMethod = meth; + } else { + prop.setMethod = meth; } } } } - for (Method meth : methods) { - String nmethname = normalize_name(meth.getName()); + + // Add arguments for superclass methods with the same names as methods declared on this type + for (Method meth : underlying_class.getMethods()) { + String nmethname = normalize(meth.getName()); PyReflectedFunction reflfunc = (PyReflectedFunction)dict.__finditem__(nmethname); if (reflfunc != null) { reflfunc.addMethod(meth); } } - Field[] fields = underlying_class.getFields(); - for (Field field : fields) { - Class<?> declaring = field.getDeclaringClass(); - if (base == null || (declaring != base && base.isAssignableFrom(declaring))) { - String fldname = field.getName(); - int fldmods = field.getModifiers(); - Class<?> fldtype = field.getType(); - if (Modifier.isStatic(fldmods)) { - if (fldname.startsWith("__doc__") && fldname.length() > 7 - && fldtype == PyString.class) { - String fname = fldname.substring(7).intern(); - PyObject memb = dict.__finditem__(fname); - if (memb != null && memb instanceof PyReflectedFunction) { - PyString doc = null; - try { - doc = (PyString)field.get(null); - } catch (IllegalAccessException e) { - throw error(e); - } - ((PyReflectedFunction)memb).__doc__ = doc; + + // Add fields declared on this type + for (Field field : underlying_class.getFields()) { + if (!declaredOnMember(base, field)) { + continue; + } + String fldname = field.getName(); + if (Modifier.isStatic(field.getModifiers())) { + if (fldname.startsWith("__doc__") && fldname.length() > 7 + && field.getType() == PyString.class) { + String fname = fldname.substring(7).intern(); + PyObject memb = dict.__finditem__(fname); + if (memb != null && memb instanceof PyReflectedFunction) { + PyString doc = null; + try { + doc = (PyString)field.get(null); + } catch (IllegalAccessException e) { + throw Py.JavaError(e); } + ((PyReflectedFunction)memb).__doc__ = doc; } } - if (dict.__finditem__(normalize_name(fldname)) == null) { - dict.__setitem__(normalize_name(fldname), new PyReflectedField(field)); - } } + if (dict.__finditem__(normalize(fldname)) == null) { + dict.__setitem__(normalize(fldname), new PyReflectedField(field)); + } } + + // Fill in the bean properties picked up while going through the methods for (PyBeanProperty prop : props.values()) { PyObject prev = dict.__finditem__(prop.__name__); - if (prev != null && (!(prev instanceof PyReflectedField) - || !Modifier.isStatic(((PyReflectedField)prev).field.getModifiers()))) { - continue; - } if (prev != null) { - prop.field = ((PyReflectedField)prev).field; + if (!(prev instanceof PyReflectedField) + || !Modifier.isStatic(((PyReflectedField)prev).field.getModifiers())) { + // Any methods or non-static fields take precedence over the bean property + continue; + } else { + // Must've been a static field, so add it to the property + prop.field = ((PyReflectedField)prev).field; + } } + // If the return types on the set and get methods for a property don't agree, the get + // get method takes precedence if (prop.getMethod != null && prop.setMethod != null && prop.getMethod.getReturnType() != prop.setMethod.getReturnType()) { prop.setMethod = null; @@ -166,39 +175,37 @@ Method m = underlying_class.getMethod("classDictInit", PyObject.class); m.invoke(null, dict); } catch (Exception exc) { - throw error(exc); + throw Py.JavaError(exc); } } if (base != Object.class) { - has_set = get_descr_method(underlying_class, "__set__", OO) != null - || get_descr_method(underlying_class, "_doset", OO) != null; - has_delete = get_descr_method(underlying_class, "__delete__", PyObject.class) != null - || get_descr_method(underlying_class, "_dodel", PyObject.class) != null; + has_set = getDescrMethod(underlying_class, "__set__", OO) != null + || getDescrMethod(underlying_class, "_doset", OO) != null; + has_delete = getDescrMethod(underlying_class, "__delete__", PyObject.class) != null + || getDescrMethod(underlying_class, "_dodel", PyObject.class) != null; } } - private static String normalize_name(String name) { + private static boolean declaredOnMember(Class<?> base, Member declaring) { + return base == null || (declaring.getDeclaringClass() != base && + base.isAssignableFrom(declaring.getDeclaringClass())); + } + + private static String normalize(String name) { if (name.endsWith("$")) { name = name.substring(0, name.length() - 1); } return name.intern(); } - private static Method get_non_static_method(Class<?> c, String name, Class<?>... parmtypes) { + private static Method getDescrMethod(Class<?> c, String name, Class<?>... parmtypes) { + Method meth; try { - Method meth = c.getMethod(name, parmtypes); - if (!Modifier.isStatic(meth.getModifiers())) { - return meth; - } + meth = c.getMethod(name, parmtypes); } catch (NoSuchMethodException e) { - // ok + return null; } - return null; - } - - private static Method get_descr_method(Class<?> c, String name, Class<?>... parmtypes) { - Method meth = get_non_static_method(c, name, parmtypes); - if (meth != null && meth.getDeclaringClass() != PyObject.class) { + if (!Modifier.isStatic(meth.getModifiers()) && meth.getDeclaringClass() != PyObject.class) { return meth; } return null; @@ -214,11 +221,7 @@ return false; } - private static PyException error(Exception e) { - return Py.JavaError(e); - } - - protected static final PyBuiltinMethodNarrow LEN_PROXY = + private static final PyBuiltinMethodNarrow LEN_PROXY = new PyBuiltinMethodNarrow("__len__", 0, 0) { @Override public PyObject __call__() { @@ -226,7 +229,7 @@ } }; - protected static final PyBuiltinMethodNarrow MAP_GET_PROXY = + private static final PyBuiltinMethodNarrow MAP_GET_PROXY = new PyBuiltinMethodNarrow("__getitem__", 1, 1) { @Override public PyObject __call__(PyObject key) { @@ -234,7 +237,7 @@ } }; - protected static final PyBuiltinMethodNarrow MAP_PUT_PROXY = + private static final PyBuiltinMethodNarrow MAP_PUT_PROXY = new PyBuiltinMethodNarrow("__setitem__", 2, 2) { @Override public PyObject __call__(PyObject key, PyObject value) { @@ -244,7 +247,7 @@ } }; - protected static final PyBuiltinMethodNarrow MAP_REMOVE_PROXY = + private static final PyBuiltinMethodNarrow MAP_REMOVE_PROXY = new PyBuiltinMethodNarrow("__delitem__", 1, 1) { @Override public PyObject __call__(PyObject key, PyObject value) { @@ -252,7 +255,7 @@ } }; - protected static final PyBuiltinMethodNarrow LIST_GET_PROXY = + private static final PyBuiltinMethodNarrow LIST_GET_PROXY = new PyBuiltinMethodNarrow("__getitem__", 1, 1){ @Override public PyObject __call__(PyObject key) { @@ -264,7 +267,7 @@ } }; - protected static final PyBuiltinMethodNarrow LIST_SET_PROXY = + private static final PyBuiltinMethodNarrow LIST_SET_PROXY = new PyBuiltinMethodNarrow("__setitem__", 2, 2) { @Override public PyObject __call__(PyObject key, PyObject value) { @@ -278,7 +281,7 @@ } }; - protected static final PyBuiltinMethodNarrow LIST_REMOVE_PROXY = + private static final PyBuiltinMethodNarrow LIST_REMOVE_PROXY = new PyBuiltinMethodNarrow("__delitem__", 1, 1) { @Override public PyObject __call__(PyObject key, PyObject value) { @@ -290,14 +293,14 @@ } }; - public static final PyBuiltinMethodNarrow ITERABLE_PROXY = + private static final PyBuiltinMethodNarrow ITERABLE_PROXY = new PyBuiltinMethodNarrow("__iter__", 0, 0) { public PyObject __call__() { return new IteratorIter(((Iterable)self.javaProxy).iterator()); } }; - public static final PyBuiltinMethodNarrow EQUALS_PROXY = + private static final PyBuiltinMethodNarrow EQUALS_PROXY = new PyBuiltinMethodNarrow("__eq__", 1, 1) { @Override public PyObject __call__(PyObject o) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cg...@us...> - 2008-12-04 01:27:37
|
Revision: 5689 http://jython.svn.sourceforge.net/jython/?rev=5689&view=rev Author: cgroves Date: 2008-12-04 01:27:28 +0000 (Thu, 04 Dec 2008) Log Message: ----------- Only add inner classes to the dict of a Java type if there isn't already something with that name. Fixes test_cpickle Modified Paths: -------------- branches/newstyle-java-types/src/org/python/core/PyJavaType.java Modified: branches/newstyle-java-types/src/org/python/core/PyJavaType.java =================================================================== --- branches/newstyle-java-types/src/org/python/core/PyJavaType.java 2008-12-04 01:10:43 UTC (rev 5688) +++ branches/newstyle-java-types/src/org/python/core/PyJavaType.java 2008-12-04 01:27:28 UTC (rev 5689) @@ -245,7 +245,10 @@ dict.__setitem__("__init__", reflctr); } for (Class<?> inner : underlying_class.getClasses()) { - dict.__setitem__(inner.getSimpleName(), PyType.fromClass(inner)); + // Only add the class if there isn't something else with that name + if (dict.__finditem__(inner.getSimpleName()) == null) { + dict.__setitem__(inner.getSimpleName(), PyType.fromClass(inner)); + } } for (Map.Entry<Class<?>, PyBuiltinMethod[]> entry : getCollectionProxies().entrySet()) { if (entry.getKey() == underlying_class) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cg...@us...> - 2008-12-04 23:52:04
|
Revision: 5693 http://jython.svn.sourceforge.net/jython/?rev=5693&view=rev Author: cgroves Date: 2008-12-04 23:52:01 +0000 (Thu, 04 Dec 2008) Log Message: ----------- Expose __iter__ on Iterator in addition to Iterable and Map Modified Paths: -------------- branches/newstyle-java-types/src/org/python/core/PyJavaType.java Modified: branches/newstyle-java-types/src/org/python/core/PyJavaType.java =================================================================== --- branches/newstyle-java-types/src/org/python/core/PyJavaType.java 2008-12-04 02:30:34 UTC (rev 5692) +++ branches/newstyle-java-types/src/org/python/core/PyJavaType.java 2008-12-04 23:52:01 UTC (rev 5693) @@ -349,14 +349,18 @@ } } - private static class IterableIter extends PyIterator { + private static class IteratorIter extends PyIterator { private Iterator<Object> proxy; - public IterableIter(Iterable<Object> proxy) { - this.proxy = proxy.iterator(); + public IteratorIter(Iterable<Object> proxy) { + this(proxy.iterator()); } + public IteratorIter(Iterator<Object> proxy) { + this.proxy = proxy; + } + public PyObject __iternext__() { return proxy.hasNext() ? Py.java2py(proxy.next()) : null; } @@ -388,7 +392,7 @@ PyBuiltinMethodNarrow iterableProxy = new PyBuiltinMethodNarrow("__iter__", 0, 0) { public PyObject __call__() { - return new IterableIter(((Iterable)self.getJavaProxy())); + return new IteratorIter(((Iterable)self.getJavaProxy())); } }; collectionProxies.put(Iterable.class, new PyBuiltinMethod[] {iterableProxy}); @@ -411,6 +415,13 @@ collectionProxies.put(Collection.class, new PyBuiltinMethod[] {lenProxy, containsProxy}); + PyBuiltinMethodNarrow iteratorProxy = new PyBuiltinMethodNarrow("__iter__", 0, 0) { + public PyObject __call__() { + return new IteratorIter(((Iterator)self.getJavaProxy())); + } + }; + collectionProxies.put(Iterator.class, new PyBuiltinMethod[] {iteratorProxy}); + // Map doesn't extend Collection, so it needs its own version of len, iter and contains PyBuiltinMethodNarrow mapLenProxy = new MapMethod("__len__", 0, 0) { @Override @@ -421,7 +432,7 @@ PyBuiltinMethodNarrow mapIterProxy = new MapMethod("__iter__", 0, 0) { @Override public PyObject __call__() { - return new IterableIter(asMap().keySet()); + return new IteratorIter(asMap().keySet()); } }; PyBuiltinMethodNarrow mapContainsProxy = new MapMethod("__contains__", 1, 1) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cg...@us...> - 2008-12-05 00:26:56
|
Revision: 5694 http://jython.svn.sourceforge.net/jython/?rev=5694&view=rev Author: cgroves Date: 2008-12-05 00:26:54 +0000 (Fri, 05 Dec 2008) Log Message: ----------- Expose __hash__ on Object. I'm amazed at the number of things that passed without this Modified Paths: -------------- branches/newstyle-java-types/src/org/python/core/PyJavaType.java Modified: branches/newstyle-java-types/src/org/python/core/PyJavaType.java =================================================================== --- branches/newstyle-java-types/src/org/python/core/PyJavaType.java 2008-12-04 23:52:01 UTC (rev 5693) +++ branches/newstyle-java-types/src/org/python/core/PyJavaType.java 2008-12-05 00:26:54 UTC (rev 5694) @@ -291,6 +291,13 @@ } }; dict.__setitem__("__eq__", new PyMethodDescr(this, equals)); + PyBuiltinCallable hash = new PyBuiltinMethodNarrow("__hash__", 0, 0) { + @Override + public PyObject __call__() { + return Py.newInteger(self.getJavaProxy().hashCode()); + } + }; + dict.__setitem__("__hash__", new PyMethodDescr(this, hash)); PyBuiltinCallable repr = new PyBuiltinMethodNarrow("__repr__", 0, 0) { @Override public PyObject __call__() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cg...@us...> - 2008-12-05 12:22:35
|
Revision: 5701 http://jython.svn.sourceforge.net/jython/?rev=5701&view=rev Author: cgroves Date: 2008-12-05 11:38:02 +0000 (Fri, 05 Dec 2008) Log Message: ----------- Avoid non-public interface methods similarly to non-public class methods Modified Paths: -------------- branches/newstyle-java-types/src/org/python/core/PyJavaType.java Modified: branches/newstyle-java-types/src/org/python/core/PyJavaType.java =================================================================== --- branches/newstyle-java-types/src/org/python/core/PyJavaType.java 2008-12-05 11:21:55 UTC (rev 5700) +++ branches/newstyle-java-types/src/org/python/core/PyJavaType.java 2008-12-05 11:38:02 UTC (rev 5701) @@ -327,6 +327,10 @@ private void handleSuperMethodArgCollisions() { for (Class iface : underlying_class.getInterfaces()) { for (Method meth : iface.getMethods()) { + if (!Modifier.isPublic(meth.getDeclaringClass().getModifiers())) { + // Ignore methods from non-public interfaces as they're similarly bugged + continue; + } String nmethname = normalize(meth.getName()); PyObject[] where = new PyObject[1]; PyObject obj = lookup_where(nmethname, where); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |