Paul Sokolovsky
5bf1b4e9d9
unix/modjni: array(): Support creation of object arrays.
2016-09-18 13:37:40 +03:00
Paul Sokolovsky
ee324c501e
unix/modjni: Add array() top-level function to create Java array.
...
Takes element primitive type encoded as a char per standard JNI encoding,
and array size. TODO: Support object arrays.
2016-09-17 16:14:02 +03:00
Paul Sokolovsky
3fea1f014c
unix/modjni: Implement subscription for object arrays.
2016-09-16 00:59:48 +03:00
Paul Sokolovsky
3c7e1b80ac
unix/modjni: Add missing get_jclass_name() function.
2015-11-11 16:43:27 +02:00
Paul Sokolovsky
91f2168dd5
unix/modjni: Actually check argument type when doing method resolution.
...
This is required to properly select among overloaded methods. It however
relies on java.lang.Object-overloaded method to come last, which appears
to be the case for OpenJDK.
2015-10-23 00:33:54 +03:00
Paul Sokolovsky
9ebd4dabf2
unix/modjni: Don't pass Java object to a method which doesn't expect it.
...
For example, don't pass Integer to double method. This is still not
selective enough to choose the right overloaded method maong those
taking objects.
2015-10-22 01:35:17 +03:00
Paul Sokolovsky
fe29cc192d
unix/modjni: Add iteration support for Java List objects.
...
Using generic iteration-via-subscription support (TODO: factor it out for
reuse).
2015-10-14 00:36:03 +03:00
Paul Sokolovsky
41eb705477
unix/modjni: call_method: Check for Java exception after method return.
2015-10-14 00:25:10 +03:00
Paul Sokolovsky
1b586f3a73
py: Rename MP_BOOL() to mp_obj_new_bool() for consistency in naming.
2015-10-11 15:18:15 +03:00
Paul Sokolovsky
7381b7ac71
unix/modjni: py2jvalue: Support bool and None values.
2015-10-10 01:20:48 +03:00
Paul Sokolovsky
02041bf2e0
unix/modjni: jvalue2py() is currently not used.
...
Not remove so far, may be needed later.
2015-10-09 00:27:27 +03:00
Paul Sokolovsky
216b6a494e
unix/modjni: Allow to access fields of objects.
2015-10-08 16:57:02 +03:00
Paul Sokolovsky
fd38799049
unix/modjni: After Call*Method(), Java exception should always be checked.
...
OpenJDK seemed to return NULL in case of exception, but Dalvik returns
arbitrary value, so skip such "optimizations".
2015-10-07 07:40:29 +03:00
Paul Sokolovsky
1ea4b77a9a
unix/modjni: jclass.__str__/__repr__: Return Java .toString() value.
2015-10-04 01:57:07 +03:00
Paul Sokolovsky
f22be4ebd9
unix/modjni: jobject.__str__/__repr__: Return Java .toString() value.
2015-10-03 08:58:46 -07:00
Paul Sokolovsky
9e0a3d46b6
unix/modjni: Convert Java's IndexOutOfBoundsException to Python's IndexError.
2015-10-02 00:22:09 -07:00
Paul Sokolovsky
c4489a0543
unix/modjni: Propagate Java exceptions on list access.
2015-10-01 01:20:56 -07:00
Paul Sokolovsky
0eba162ab5
unix/modjni: Fix method argument matching.
2015-09-30 00:55:09 -07:00
Paul Sokolovsky
f3ca8623f7
unix/modjni: Implement len() for objects with java.util.List interface.
2015-09-29 10:06:07 -07:00
Paul Sokolovsky
77020281ae
unix/modjni: call_method: Delete done local references in loop.
...
To avoid local ref table overflow.
2015-09-28 08:37:34 -07:00
Paul Sokolovsky
0d28a3edb9
unix/modjni: call_method: Better resource release.
2015-09-27 22:32:54 -07:00
Paul Sokolovsky
81d64ab939
unix/modjni: call_method(): If name doesn't match, cleanup via goto next_method.
2015-09-26 08:51:22 -07:00
Paul Sokolovsky
c0a79cc919
unix/modjni: Need to really use per-rettype Call*Method functions.
2015-09-26 08:49:12 -07:00
Paul Sokolovsky
7e18d3b6ff
unix/modjni: new_jobject(): Handle null reference.
2015-09-24 15:29:57 -07:00
Paul Sokolovsky
e632b1fda7
unix/modjni: Factor out is_object_type().
2015-09-23 07:11:56 -07:00
Paul Sokolovsky
ed22e9ba3e
unix/modjni: Move type analysis logic to new_jobject(), for reuse.
2015-09-22 17:02:17 -07:00
Paul Sokolovsky
b2d880d749
unix/modjni: Support for subscripting of Java lists (r/o so far).
2015-09-21 12:02:54 -07:00
Paul Sokolovsky
6196aa45ed
unix/modjni: jvalue2py: Handle boolean.
2015-09-20 00:36:51 +03:00
Paul Sokolovsky
1e9d8e110b
unix/modjni: py2jvalue: Pass jobject's down to Java.
...
So far, no signature check is done (TODO).
2015-09-19 01:05:25 +03:00
Paul Sokolovsky
011c7f5718
unix/modjni: py2jvalue: Handle both int and long java types (with TODO for long).
2015-09-18 13:21:21 +03:00
Paul Sokolovsky
1cb5de2cd5
unix/modjni: jvalue2py: Handle class-containing jvalues.
2015-09-17 13:31:40 +03:00
Paul Sokolovsky
cb6cf5e257
unix/modjni: Add env() module function.
...
Useful to load native method libraries not loaded by VM (as happens on
Android).
2015-09-16 01:10:09 +03:00
Paul Sokolovsky
b230a86d33
unix/modjni: Return any object type value as a jobject.
2015-09-15 14:07:39 +03:00
Paul Sokolovsky
5167332131
unix/modjni: Return Java null as Python None.
2015-09-14 00:15:35 +03:00
Paul Sokolovsky
7a4b10cc4c
unix/modjni: Support static methods.
2015-09-14 00:12:47 +03:00
Paul Sokolovsky
26a9b4d48e
unix/modjni: Factor out new_jobject(), jvalue2py() functions.
2015-09-13 01:27:47 +03:00
Paul Sokolovsky
4e7bde8c9e
unix/modjni: Factor out py2jvalue() function.
2015-09-12 00:20:06 +03:00
Paul Sokolovsky
e79c6b6312
unix/modjni: "jni" module to interface to JNI-compliant JavaVM.
...
This includes Android Dalvik VM for example.
Example usage:
import jni
System = jni.cls("java/lang/System")
System.out.println("Hello, Java!")
2015-09-11 21:38:57 +03:00