jwrapper: make name-related methods lazy
authorJean Privat <jean@pryen.org>
Fri, 29 Apr 2016 15:43:46 +0000 (11:43 -0400)
committerJean Privat <jean@pryen.org>
Fri, 29 Apr 2016 15:52:05 +0000 (11:52 -0400)
for bin/jwrapper /usr/share/java/ant.jar

before: 0m4.308s
after: 0m3.360s

Signed-off-by: Jean Privat <jean@pryen.org>

contrib/jwrapper/src/model.nit

index bfbbdf0..01600ae 100644 (file)
@@ -107,16 +107,16 @@ class JavaType
        end
 
        # Short name of the class, mangled to remove `$` (e.g. `Set`)
-       fun id: String do return identifier.last.replace("$", "")
+       var id: String is lazy do return identifier.last.replace("$", "")
 
        # Full name of this class as used in java code (e.g. `java.lang.Set`)
-       fun java_full_name: String do return identifier.join(".").replace("$", ".")
+       var java_full_name: String is lazy do return identifier.join(".").replace("$", ".")
 
        # Full name of this class as used by jni (e.g. `android.graphics.BitmapFactory$Options`)
-       fun jni_full_name: String do return identifier.join(".")
+       var jni_full_name: String is lazy do return identifier.join(".")
 
        # Name of this class for the extern declaration in Nit (e.g. `java.lang.Set[]`)
-       fun extern_equivalent: String do return jni_full_name + "[]" * array_dimension
+       var extern_equivalent: String is lazy do return jni_full_name + "[]" * array_dimension
 
        # Full name of this class with arrays and generic values (e.g. `java.lang.Set<E>[]`)
        redef fun to_s do