Closed xymus closed 5 years ago
contrib/jwrapper/examples/queue
seems to fail: https://gitlab.com/nit/nit-ci/-/jobs/168648150
also tests/test_ffi_java_use_module.nit
fails with nic --global
Fixed failing tests with global and semi-global compilation modes, and the use of custom CLASSPATH.
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 simpleint
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 ofint
, addressing to the same pointer bug. Only low-level services should still uselong
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
forfilename
to be relative to the compilation folder. This required updating previous usages.