aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Ducrohet <xav@android.com>2010-10-20 13:23:48 -0700
committerAndroid Code Review <code-review@android.com>2010-10-20 13:23:48 -0700
commit64ea97d673cd05c740e118d67f2b1e8110542b51 (patch)
treeee0afeb707d397d81b794d51f513ebb9e6bb4220
parentf4ca7ef327b0ba465d1f6e42515011edc6bf4517 (diff)
parenteb93a3b24ab6c9b96d63b87fa205678f39e9176a (diff)
downloadsdk-64ea97d673cd05c740e118d67f2b1e8110542b51.zip
sdk-64ea97d673cd05c740e118d67f2b1e8110542b51.tar.gz
sdk-64ea97d673cd05c740e118d67f2b1e8110542b51.tar.bz2
Merge "Integrate 5397067d into tools_r8. DO NOT MERGE." into tools_r8
-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);
}
}