aboutsummaryrefslogtreecommitdiffstats
path: root/monkeyrunner
diff options
context:
space:
mode:
authorBill Napier <napier@google.com>2010-10-19 10:54:31 -0700
committerAndroid Code Review <code-review@android.com>2010-10-19 10:54:31 -0700
commit64c8ad05851372cd522bb8e1ff84da9326c6e576 (patch)
treefebbedd0f72944f6d00f3fc1ce1aaf34cadaea72 /monkeyrunner
parent66baed7e5ff8668a85ee728ebd210009b64e0152 (diff)
parent5397067da9a1dc97ca2d4d036c9614da2f3af46f (diff)
downloadsdk-64c8ad05851372cd522bb8e1ff84da9326c6e576.zip
sdk-64c8ad05851372cd522bb8e1ff84da9326c6e576.tar.gz
sdk-64c8ad05851372cd522bb8e1ff84da9326c6e576.tar.bz2
Merge "Fix field visibility by ensuring they stay in __dict__."
Diffstat (limited to 'monkeyrunner')
-rw-r--r--monkeyrunner/src/com/android/monkeyrunner/JythonUtils.java20
1 files changed, 19 insertions, 1 deletions
diff --git a/monkeyrunner/src/com/android/monkeyrunner/JythonUtils.java b/monkeyrunner/src/com/android/monkeyrunner/JythonUtils.java
index 8d25dd9..864441e 100644
--- a/monkeyrunner/src/com/android/monkeyrunner/JythonUtils.java
+++ b/monkeyrunner/src/com/android/monkeyrunner/JythonUtils.java
@@ -38,6 +38,7 @@ import org.python.core.PyInteger;
import org.python.core.PyList;
import org.python.core.PyNone;
import org.python.core.PyObject;
+import org.python.core.PyReflectedField;
import org.python.core.PyReflectedFunction;
import org.python.core.PyString;
import org.python.core.PyStringMap;
@@ -302,9 +303,26 @@ public final class JythonUtils {
}
}
+ // Also look at all the fields (both static and instance).
+ for (Field f : clz.getFields()) {
+ if (f.isAnnotationPresent(MonkeyRunnerExported.class)) {
+ String fieldName = f.getName();
+ PyObject pyField = dict.__finditem__(fieldName);
+ if (pyField != null && pyField instanceof PyReflectedField) {
+ PyReflectedField realPyfield = (PyReflectedField) pyField;
+ MonkeyRunnerExported doc = f.getAnnotation(MonkeyRunnerExported.class);
+
+ // TODO: figure out how to set field documentation. __doc__ is Read Only
+ // in this context.
+ // realPyfield.__setattr__("__doc__", new PyString(buildDoc(doc)));
+ functions.remove(fieldName);
+ }
+ }
+ }
+
// Now remove any elements left from the functions collection
for (String name : functions) {
- dict.__delitem__(name);
+ dict.__delitem__(name);
}
}