From 7294c7821520765b99dd4bae066963c1506bff78 Mon Sep 17 00:00:00 2001 From: lmp Date: Sun, 15 Sep 2024 14:22:13 +0200 Subject: [PATCH] all: run `v fmt -w .` in project root --- examples/desktop/v_as_library/libvlang.v | 7 +++---- jni.v | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/examples/desktop/v_as_library/libvlang.v b/examples/desktop/v_as_library/libvlang.v index 9b7e39b..b2b4683 100644 --- a/examples/desktop/v_as_library/libvlang.v +++ b/examples/desktop/v_as_library/libvlang.v @@ -97,7 +97,7 @@ fn jprintln(text string) { // 2. typeof(text).name // 3. auto... // 4. .call_static_method(meth,text) - meth := libvlang.pkg + '.' + jni.v2j_fn_name(@FN) + '(' + typeof(text).name + ')' + meth := pkg + '.' + jni.v2j_fn_name(@FN) + '(' + typeof(text).name + ')' auto.call_static_method(meth, text) } @@ -107,10 +107,9 @@ fn jprintln(text string) { */ // java_float_func is "reflected" from "public static float javaFloatFunc(String s, int i)" in "io.vlang.V" fn java_float_func(text string, i int) f32 { - return auto.call_static_method(jni.sig(libvlang.pkg, @FN, f32(0), text, i), text, - i).result as f32 + return auto.call_static_method(jni.sig(pkg, @FN, f32(0), text, i), text, i).result as f32 } fn java_void_func(text string, i int) { - auto.call_static_method(jni.sig(libvlang.pkg, @FN, 'void', text, i), text, i) + auto.call_static_method(jni.sig(pkg, @FN, 'void', text, i), text, i) } diff --git a/jni.v b/jni.v index 8b39dc7..aa9e885 100644 --- a/jni.v +++ b/jni.v @@ -319,13 +319,13 @@ pub fn (jo JavaObject) class_name(env &Env) string { mut cls := get_object_class(env, obj) // First get the class object mut mid := get_method_id(env, cls, 'getClass', '()Ljava/lang/Class;') - cls_obj := call_object_method_a(env, obj, mid, jni.void_arg.data) // NOTE vfmt will cause a compile error here if you only use 'void_arg.data' + cls_obj := call_object_method_a(env, obj, mid, void_arg.data) // NOTE vfmt will cause a compile error here if you only use 'void_arg.data' // Get the class object's class descriptor cls = get_object_class(env, cls_obj) // Find the getName() method on the class object mid = get_method_id(env, cls, 'getName', '()Ljava/lang/String;') // Call the getName() to get a string struct back - return call_string_method_a(env, cls_obj, mid, jni.void_arg.data) // NOTE vfmt will cause a compile error here if you only use 'void_arg.data' + return call_string_method_a(env, cls_obj, mid, void_arg.data) // NOTE vfmt will cause a compile error here if you only use 'void_arg.data' } @[inline]