X-Git-Url: http://nitlanguage.org diff --git a/contrib/jwrapper/src/types.nit b/contrib/jwrapper/src/types.nit index efe1d01..4fb5251 100644 --- a/contrib/jwrapper/src/types.nit +++ b/contrib/jwrapper/src/types.nit @@ -93,15 +93,16 @@ class JavaType do if is_wrapped then return new NitType.with_module(find_extern_class.as(not null).first, find_extern_class.as(not null).second) - var name = "Native" + extern_class_name.join("") - var nit_type: NitType - if self.is_primitive_array then - nit_type = new NitType.with_generic_params("Array", name) + var name + if is_primitive_array then + # Primitive arrays have a special naming convention + name = "Native" + extern_class_name.join("").capitalized + "Array" else - nit_type = new NitType("Native" + extern_class_name.join("")) + name = "Native" + extern_class_name.join("") end - nit_type.is_complete = false + var nit_type = new NitType(name) + nit_type.is_complete = false return nit_type end @@ -173,12 +174,11 @@ class JavaType # Search inside `lib/android` directory for already wrapped classes # If found, contains the class identifier and the Nit Module name - var find_extern_class: nullable Couple[String, NitModule] = find_extern_class_fun is lazy + var find_extern_class: nullable Couple[String, NitModule] is lazy do - private fun find_extern_class_fun: nullable Couple[String, NitModule] - do - var regex = "extern class Native[a-zA-Z1-9]\\\+[ ]\\\+in[ ]\\\+\"Java\"[ ]*`\{[ ]*" + self.to_s + "\\\+[ ]*`\}" - var grep = new IProcess("grep", "-r", regex, "{"NIT_DIR".environ}/lib/android/") + var regex = "extern class [a-zA-Z1-9]\\\+[ ]\\\+in[ ]\\\+\"Java\"[ ]*`\{[ ]*" + self.to_s + "\\\+[ ]*`\}" + var nit_dir = "NIT_DIR".environ + var grep = new IProcess("grep", "-r", regex, nit_dir/"lib/android/", nit_dir/"lib/java/") var to_eat = ["private", "extern", "class"] var output = grep.read_line