github.com/thommil/tge-mobile@v0.0.0-20190308225214-66a08abd51aa/bind/testdata/issue12403.java.c.golden (about)

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