[pypy-svn] r50593 - pypy/branch/fixed-list-ootype/pypy/translator/jvm/src/pypy
atobe at codespeak.net
atobe at codespeak.net
Mon Jan 14 14:53:30 CET 2008
Author: atobe
Date: Mon Jan 14 14:53:30 2008
New Revision: 50593
Modified:
pypy/branch/fixed-list-ootype/pypy/translator/jvm/src/pypy/PyPy.java
Log:
(cfbolz, atobe): some reflection hackery to make java arrays returnable from java code to the test. Used only when testing.
Modified: pypy/branch/fixed-list-ootype/pypy/translator/jvm/src/pypy/PyPy.java
==============================================================================
--- pypy/branch/fixed-list-ootype/pypy/translator/jvm/src/pypy/PyPy.java (original)
+++ pypy/branch/fixed-list-ootype/pypy/translator/jvm/src/pypy/PyPy.java Mon Jan 14 14:53:30 2008
@@ -7,6 +7,7 @@
import java.util.Arrays;
import java.util.Map;
import java.text.DecimalFormat;
+import java.lang.reflect.Array;
/**
* Class with a number of utility routines. One instance of this is
@@ -398,7 +399,16 @@
sb.append("]");
return sb.toString();
}
- else if (o instanceof String) {
+ if (o.getClass().isArray()) {
+ StringBuffer sb = new StringBuffer();
+ sb.append("[");
+ for (int i = 0; i < Array.getLength(o); i++) {
+ sb.append(serializeObject(Array.get(o, i))).append(",");
+ }
+ sb.append("]");
+ return sb.toString();
+ }
+ if (o instanceof String) {
return escaped_string((String)o);
}
return o.toString();
More information about the Pypy-commit
mailing list