github.com/coming-chat/gomobile@v0.0.0-20220601074111-56995f7d7aba/bind/testdata/java.java.c.golden (about) 1 // Code generated by gobind. DO NOT EDIT. 2 3 4 #include <jni.h> 5 #include "seq.h" 6 #include "classes.h" 7 8 static jclass class_java_lang_Float; 9 static jmethodID m_java_lang_Float_toString; 10 static jclass class_java_lang_Long; 11 static jmethodID m_java_lang_Long_toString; 12 static jclass class_java_lang_Object; 13 static jmethodID m_java_lang_Object_toString; 14 static jclass class_java_lang_Runnable; 15 16 void init_proxies() { 17 JNIEnv *env = go_seq_push_local_frame(4); 18 jclass clazz; 19 clazz = go_seq_find_class("java/lang/Float"); 20 if (clazz != NULL) { 21 class_java_lang_Float = (*env)->NewGlobalRef(env, clazz); 22 m_java_lang_Float_toString = go_seq_get_method_id(clazz, "toString", "()Ljava/lang/String;"); 23 } 24 clazz = go_seq_find_class("java/lang/Long"); 25 if (clazz != NULL) { 26 class_java_lang_Long = (*env)->NewGlobalRef(env, clazz); 27 m_java_lang_Long_toString = go_seq_get_method_id(clazz, "toString", "()Ljava/lang/String;"); 28 } 29 clazz = go_seq_find_class("java/lang/Object"); 30 if (clazz != NULL) { 31 class_java_lang_Object = (*env)->NewGlobalRef(env, clazz); 32 m_java_lang_Object_toString = go_seq_get_method_id(clazz, "toString", "()Ljava/lang/String;"); 33 } 34 clazz = go_seq_find_class("java/lang/Runnable"); 35 if (clazz != NULL) { 36 class_java_lang_Runnable = (*env)->NewGlobalRef(env, clazz); 37 } 38 go_seq_pop_local_frame(env); 39 } 40 41 ret_nstring cproxy_java_lang_Float_toString(jint this) { 42 JNIEnv *env = go_seq_push_local_frame(1); 43 // Must be a Java object 44 jobject _this = go_seq_from_refnum(env, this, NULL, NULL); 45 jstring res = (*env)->CallObjectMethod(env, _this, m_java_lang_Float_toString); 46 jobject _exc = go_seq_get_exception(env); 47 int32_t _exc_ref = go_seq_to_refnum(env, _exc); 48 if (_exc != NULL) { 49 res = NULL; 50 } 51 nstring _res = go_seq_from_java_string(env, res); 52 go_seq_pop_local_frame(env); 53 ret_nstring __res = {_res, _exc_ref}; 54 return __res; 55 } 56 57 ret_nstring cproxy_java_lang_Long_toString(jint this) { 58 JNIEnv *env = go_seq_push_local_frame(1); 59 // Must be a Java object 60 jobject _this = go_seq_from_refnum(env, this, NULL, NULL); 61 jstring res = (*env)->CallObjectMethod(env, _this, m_java_lang_Long_toString); 62 jobject _exc = go_seq_get_exception(env); 63 int32_t _exc_ref = go_seq_to_refnum(env, _exc); 64 if (_exc != NULL) { 65 res = NULL; 66 } 67 nstring _res = go_seq_from_java_string(env, res); 68 go_seq_pop_local_frame(env); 69 ret_nstring __res = {_res, _exc_ref}; 70 return __res; 71 } 72 73 ret_nstring cproxy_java_lang_Object_toString(jint this) { 74 JNIEnv *env = go_seq_push_local_frame(1); 75 // Must be a Java object 76 jobject _this = go_seq_from_refnum(env, this, NULL, NULL); 77 jstring res = (*env)->CallObjectMethod(env, _this, m_java_lang_Object_toString); 78 jobject _exc = go_seq_get_exception(env); 79 int32_t _exc_ref = go_seq_to_refnum(env, _exc); 80 if (_exc != NULL) { 81 res = NULL; 82 } 83 nstring _res = go_seq_from_java_string(env, res); 84 go_seq_pop_local_frame(env); 85 ret_nstring __res = {_res, _exc_ref}; 86 return __res; 87 } 88 89 // Code generated by gobind. DO NOT EDIT. 90 91 // JNI functions for the Go <=> Java bridge. 92 // 93 // autogenerated by gobind -lang=java java 94 95 #include <android/log.h> 96 #include <stdint.h> 97 #include "seq.h" 98 #include "_cgo_export.h" 99 #include "java.h" 100 101 jclass proxy_class_java_F; 102 jmethodID proxy_class_java_F_cons; 103 static jmethodID mid_F_ToString; 104 jclass proxy_class_java_L; 105 jmethodID proxy_class_java_L_cons; 106 static jmethodID mid_L_ToString; 107 jclass proxy_class_java_O; 108 jmethodID proxy_class_java_O_cons; 109 static jmethodID mid_O_ToString; 110 jclass proxy_class_java_R; 111 jmethodID proxy_class_java_R_cons; 112 113 JNIEXPORT void JNICALL 114 Java_java_Java__1init(JNIEnv *env, jclass _unused) { 115 jclass clazz; 116 clazz = (*env)->FindClass(env, "java/Java$proxyF"); 117 proxy_class_java_F = (*env)->NewGlobalRef(env, clazz); 118 proxy_class_java_F_cons = (*env)->GetMethodID(env, clazz, "<init>", "(I)V"); 119 clazz = (*env)->FindClass(env, "java/F"); 120 mid_F_ToString = (*env)->GetMethodID(env, clazz, "toString", "()Ljava/lang/String;"); 121 122 clazz = (*env)->FindClass(env, "java/Java$proxyL"); 123 proxy_class_java_L = (*env)->NewGlobalRef(env, clazz); 124 proxy_class_java_L_cons = (*env)->GetMethodID(env, clazz, "<init>", "(I)V"); 125 clazz = (*env)->FindClass(env, "java/L"); 126 mid_L_ToString = (*env)->GetMethodID(env, clazz, "toString", "()Ljava/lang/String;"); 127 128 clazz = (*env)->FindClass(env, "java/Java$proxyO"); 129 proxy_class_java_O = (*env)->NewGlobalRef(env, clazz); 130 proxy_class_java_O_cons = (*env)->GetMethodID(env, clazz, "<init>", "(I)V"); 131 clazz = (*env)->FindClass(env, "java/O"); 132 mid_O_ToString = (*env)->GetMethodID(env, clazz, "toString", "()Ljava/lang/String;"); 133 134 clazz = (*env)->FindClass(env, "java/Java$proxyR"); 135 proxy_class_java_R = (*env)->NewGlobalRef(env, clazz); 136 proxy_class_java_R_cons = (*env)->GetMethodID(env, clazz, "<init>", "(I)V"); 137 clazz = (*env)->FindClass(env, "java/R"); 138 139 } 140 141 JNIEXPORT jstring JNICALL 142 Java_java_Java_00024proxyF_toString(JNIEnv* env, jobject __this__) { 143 int32_t o = go_seq_to_refnum_go(env, __this__); 144 nstring r0 = proxyjava_F_ToString(o); 145 jstring _r0 = go_seq_to_java_string(env, r0); 146 return _r0; 147 } 148 149 nstring cproxyjava_F_ToString(int32_t refnum) { 150 JNIEnv *env = go_seq_push_local_frame(0); 151 jobject o = go_seq_from_refnum(env, refnum, proxy_class_java_F, proxy_class_java_F_cons); 152 jstring res = (*env)->CallObjectMethod(env, o, mid_F_ToString); 153 nstring _res = go_seq_from_java_string(env, res); 154 go_seq_pop_local_frame(env); 155 return _res; 156 } 157 158 JNIEXPORT jstring JNICALL 159 Java_java_Java_00024proxyL_toString(JNIEnv* env, jobject __this__) { 160 int32_t o = go_seq_to_refnum_go(env, __this__); 161 nstring r0 = proxyjava_L_ToString(o); 162 jstring _r0 = go_seq_to_java_string(env, r0); 163 return _r0; 164 } 165 166 nstring cproxyjava_L_ToString(int32_t refnum) { 167 JNIEnv *env = go_seq_push_local_frame(0); 168 jobject o = go_seq_from_refnum(env, refnum, proxy_class_java_L, proxy_class_java_L_cons); 169 jstring res = (*env)->CallObjectMethod(env, o, mid_L_ToString); 170 nstring _res = go_seq_from_java_string(env, res); 171 go_seq_pop_local_frame(env); 172 return _res; 173 } 174 175 JNIEXPORT jstring JNICALL 176 Java_java_Java_00024proxyO_toString(JNIEnv* env, jobject __this__) { 177 int32_t o = go_seq_to_refnum_go(env, __this__); 178 nstring r0 = proxyjava_O_ToString(o); 179 jstring _r0 = go_seq_to_java_string(env, r0); 180 return _r0; 181 } 182 183 nstring cproxyjava_O_ToString(int32_t refnum) { 184 JNIEnv *env = go_seq_push_local_frame(0); 185 jobject o = go_seq_from_refnum(env, refnum, proxy_class_java_O, proxy_class_java_O_cons); 186 jstring res = (*env)->CallObjectMethod(env, o, mid_O_ToString); 187 nstring _res = go_seq_from_java_string(env, res); 188 go_seq_pop_local_frame(env); 189 return _res; 190 } 191