github.com/F4RD1N/gomobile@v1.0.1/bind/testdata/issue12403.java.c.golden (about)

     1  // Code generated by gobind. DO NOT EDIT.
     2  
     3  // JNI functions for the Go <=> Java bridge.
     4  //
     5  //   autogenerated by gobind -lang=java issue12403
     6  
     7  #include <android/log.h>
     8  #include <stdint.h>
     9  #include "seq.h"
    10  #include "_cgo_export.h"
    11  #include "issue12403.h"
    12  
    13  jclass proxy_class_issue12403_Parsable;
    14  jmethodID proxy_class_issue12403_Parsable_cons;
    15  static jmethodID mid_Parsable_FromJSON;
    16  static jmethodID mid_Parsable_ToJSON;
    17  
    18  JNIEXPORT void JNICALL
    19  Java_issue12403_Issue12403__1init(JNIEnv *env, jclass _unused) {
    20      jclass clazz;
    21      clazz = (*env)->FindClass(env, "issue12403/Issue12403$proxyParsable");
    22      proxy_class_issue12403_Parsable = (*env)->NewGlobalRef(env, clazz);
    23      proxy_class_issue12403_Parsable_cons = (*env)->GetMethodID(env, clazz, "<init>", "(I)V");
    24      clazz = (*env)->FindClass(env, "issue12403/Parsable");
    25      mid_Parsable_FromJSON = (*env)->GetMethodID(env, clazz, "fromJSON", "(Ljava/lang/String;)Ljava/lang/String;");
    26      mid_Parsable_ToJSON = (*env)->GetMethodID(env, clazz, "toJSON", "()Ljava/lang/String;");
    27      
    28  }
    29  
    30  JNIEXPORT jstring JNICALL
    31  Java_issue12403_Issue12403_00024proxyParsable_fromJSON(JNIEnv* env, jobject __this__, jstring jstr) {
    32      int32_t o = go_seq_to_refnum_go(env, __this__);
    33      nstring _jstr = go_seq_from_java_string(env, jstr);
    34      nstring r0 = proxyissue12403_Parsable_FromJSON(o, _jstr);
    35      jstring _r0 = go_seq_to_java_string(env, r0);
    36      return _r0;
    37  }
    38  
    39  nstring cproxyissue12403_Parsable_FromJSON(int32_t refnum, nstring jstr) {
    40      JNIEnv *env = go_seq_push_local_frame(1);
    41      jobject o = go_seq_from_refnum(env, refnum, proxy_class_issue12403_Parsable, proxy_class_issue12403_Parsable_cons);
    42      jstring _jstr = go_seq_to_java_string(env, jstr);
    43      jstring res = (*env)->CallObjectMethod(env, o, mid_Parsable_FromJSON, _jstr);
    44      nstring _res = go_seq_from_java_string(env, res);
    45      go_seq_pop_local_frame(env);
    46      return _res;
    47  }
    48  
    49  JNIEXPORT jstring JNICALL
    50  Java_issue12403_Issue12403_00024proxyParsable_toJSON(JNIEnv* env, jobject __this__) {
    51      int32_t o = go_seq_to_refnum_go(env, __this__);
    52      struct proxyissue12403_Parsable_ToJSON_return res = proxyissue12403_Parsable_ToJSON(o);
    53      jstring _r0 = go_seq_to_java_string(env, res.r0);
    54      jobject _r1 = go_seq_from_refnum(env, res.r1, proxy_class__error, proxy_class__error_cons);
    55      go_seq_maybe_throw_exception(env, _r1);
    56      return _r0;
    57  }
    58  
    59  struct cproxyissue12403_Parsable_ToJSON_return cproxyissue12403_Parsable_ToJSON(int32_t refnum) {
    60      JNIEnv *env = go_seq_push_local_frame(0);
    61      jobject o = go_seq_from_refnum(env, refnum, proxy_class_issue12403_Parsable, proxy_class_issue12403_Parsable_cons);
    62      jstring res = (*env)->CallObjectMethod(env, o, mid_Parsable_ToJSON);
    63      jobject exc = go_seq_get_exception(env);
    64      int32_t _exc = go_seq_to_refnum(env, exc);
    65      if (exc != NULL) {
    66          res = NULL;
    67      }
    68      nstring _res = go_seq_from_java_string(env, res);
    69      cproxyissue12403_Parsable_ToJSON_return sres = {
    70      	_res, _exc
    71      };
    72      go_seq_pop_local_frame(env);
    73      return sres;
    74  }
    75