Java FFI: fix a few warnings and improve doc
authorAlexis Laferrière <alexis.laf@xymus.net>
Tue, 26 Feb 2019 15:18:03 +0000 (10:18 -0500)
committerAlexis Laferrière <alexis.laf@xymus.net>
Tue, 26 Feb 2019 19:08:51 +0000 (14:08 -0500)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

src/c_tools.nit
src/compiler/compiler_ffi/light.nit
src/ffi/java.nit

index 1783c8e..61c1f9c 100644 (file)
@@ -119,6 +119,7 @@ class ExternFile
 
        fun compiles_to_o_file: Bool do return false
 
+       # Is `self` a Java file to include in the JAR archive?
        fun add_to_jar: Bool do return false
 
        # Additional libraries needed for the compilation
index 4adbf05..ce0f71b 100644 (file)
@@ -29,7 +29,7 @@ redef class MModule
                return v.compiler.modelbuilder.mmodule2node(self)
        end
 
-       redef fun finalize_ffi(compiler: AbstractCompiler)
+       redef fun finalize_ffi(compiler)
        do
                if not uses_ffi then return
 
index 0dd65be..a222885 100644 (file)
@@ -165,6 +165,9 @@ class JavaLanguage
 
        redef fun compile_to_files(mmodule, compdir)
        do
+               var ffi_ccu = ffi_ccu
+               assert ffi_ccu != null
+
                # Make sure we have a .java file
                mmodule.ensure_java_files
 
@@ -172,7 +175,7 @@ class JavaLanguage
                mmodule.insert_compiler_options
 
                # Enable linking C callbacks to java native methods
-               mmodule.ensure_linking_callback_methods(ffi_ccu.as(not null))
+               mmodule.ensure_linking_callback_methods(ffi_ccu)
 
                # Java implementation code
                var java_file = mmodule.java_file
@@ -343,7 +346,7 @@ class JavaClassTemplate
        fun write_to_files(compdir: String): ExternFile
        do
                var filename = "{java_class_name}.java"
-               var filepath = "{compdir}/{filename}"
+               var filepath = compdir/filename
 
                write_to_file filepath