From: <cg...@us...> - 2009-06-23 06:51:14
|
Revision: 6498 http://jython.svn.sourceforge.net/jython/?rev=6498&view=rev Author: cgroves Date: 2009-06-23 06:51:07 +0000 (Tue, 23 Jun 2009) Log Message: ----------- Don't extend PyReflectedField in PyBeanEventProperty. Fixes Issue1377 by keeping PyJavaType from accessing field spuriously on PyBeanEventProperties. Modified Paths: -------------- trunk/jython/src/org/python/core/PyBeanEventProperty.java trunk/jython/src/org/python/core/PyBeanProperty.java trunk/jython/src/org/python/core/PyJavaType.java trunk/jython/src/org/python/core/PyReflectedField.java Modified: trunk/jython/src/org/python/core/PyBeanEventProperty.java =================================================================== --- trunk/jython/src/org/python/core/PyBeanEventProperty.java 2009-06-23 06:21:59 UTC (rev 6497) +++ trunk/jython/src/org/python/core/PyBeanEventProperty.java 2009-06-23 06:51:07 UTC (rev 6498) @@ -9,7 +9,7 @@ import org.python.util.Generic; -public class PyBeanEventProperty extends PyReflectedField { +public class PyBeanEventProperty extends PyObject { private static Map<String, Class<?>> adapterClasses = Generic.map(); @@ -38,6 +38,7 @@ this.eventClass = eventClass; } + @Override public PyObject _doget(PyObject self) { if (self == null) { return this; @@ -65,6 +66,7 @@ return func; } + @Override public boolean _doset(PyObject self, PyObject value) { Object jself = Py.tojava(self, addMethod.getDeclaringClass()); if (!(value instanceof PyCompoundCallable)) { @@ -77,6 +79,7 @@ return true; } + @Override public String toString() { return "<beanEventProperty " + __name__ + " for event " + eventClass.toString() + " " + Py.idstr(this) + ">"; Modified: trunk/jython/src/org/python/core/PyBeanProperty.java =================================================================== --- trunk/jython/src/org/python/core/PyBeanProperty.java 2009-06-23 06:21:59 UTC (rev 6497) +++ trunk/jython/src/org/python/core/PyBeanProperty.java 2009-06-23 06:51:07 UTC (rev 6498) @@ -14,6 +14,7 @@ this.myType = myType; } + @Override public PyObject _doget(PyObject self) { if (self == null) { if (field != null) { @@ -36,6 +37,7 @@ } } + @Override public boolean _doset(PyObject self, PyObject value) { if (self == null) { if (field != null) { @@ -72,6 +74,7 @@ return new PyBeanProperty(__name__, myType, getMethod, setMethod); } + @Override public String toString() { String typeName = "unknown"; if (myType != null) { Modified: trunk/jython/src/org/python/core/PyJavaType.java =================================================================== --- trunk/jython/src/org/python/core/PyJavaType.java 2009-06-23 06:21:59 UTC (rev 6497) +++ trunk/jython/src/org/python/core/PyJavaType.java 2009-06-23 06:51:07 UTC (rev 6498) @@ -56,8 +56,10 @@ super(TYPE == null ? fromClass(PyType.class) : TYPE); } + @Override protected boolean useMetatypeFirst(PyObject attr) { - return !(attr instanceof PyReflectedField || attr instanceof PyReflectedFunction); + return !(attr instanceof PyReflectedField || attr instanceof PyReflectedFunction || + attr instanceof PyBeanEventProperty); } // Java types are ok with things being added and removed from their dicts as long as there isn't Modified: trunk/jython/src/org/python/core/PyReflectedField.java =================================================================== --- trunk/jython/src/org/python/core/PyReflectedField.java 2009-06-23 06:21:59 UTC (rev 6497) +++ trunk/jython/src/org/python/core/PyReflectedField.java 2009-06-23 06:51:07 UTC (rev 6498) @@ -4,7 +4,6 @@ import java.lang.reflect.Field; import java.lang.reflect.Modifier; - public class PyReflectedField extends PyObject { public Field field; @@ -14,6 +13,7 @@ this.field = field; } + @Override public PyObject _doget(PyObject self) { Object iself = null; if (!Modifier.isStatic(field.getModifiers())) { @@ -32,6 +32,7 @@ return Py.java2py(value); } + @Override public boolean _doset(PyObject self, PyObject value) { Object iself = null; if (!Modifier.isStatic(field.getModifiers())) { @@ -51,6 +52,7 @@ return true; } + @Override public String toString() { return "<reflected field "+field.toString()+" "+Py.idstr(this)+">"; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |