Merge: Java FFI: use class NitObject for references to Nit objects from Java
authorJean Privat <jean@pryen.org>
Fri, 1 Mar 2019 00:08:44 +0000 (19:08 -0500)
committerJean Privat <jean@pryen.org>
Fri, 1 Mar 2019 00:08:44 +0000 (19:08 -0500)
This PR improves the type safety of the Java FFI and fixes a bug with pointers to Nit objects at the same time.

* The main change is the introduction of the Java class `NitObject` used as a general type for Nit objects referenced from Java code. It replaces the use of a simple `int` holding the pointer value, which was the source of the Java FFI bug.

* Change internal pointers to Nit object to use the Java primitive types `long` instead of `int`, addressing to the same pointer bug. Only low-level services should still use `long` this way, in this case it is the support for Android that relies mostly on the FFI with C.

* Change the annotation `extra_java_files` to accept the full name of Java classes (package + class) instead of the path to the Java source file. The compile still looks for the file in the same directory as the Nit module.

* Clear up the documentation of the class `ExternFile` for `filename` to be relative to the compilation folder. This required updating previous usages.

Pull-Request: #2740
Reviewed-by: Jean Privat <jean@pryen.org>


Trivial merge