2
0
mirror of synced 2025-02-24 07:18:15 +00:00
mobile/bind/testdata/issue10788.java.c.golden
Elias Naur 5b452fe89a bind: split out Seq.getRef calls with Go references
Today, the Seq.Ref class has two purposes. For Java references,
Ref contains the refnum, a reference to the Java object and a
reference count. For Go references, Ref contains the refnum and
its finalizer makes sure to decrement the reference count on the Go
side.

The next CL will replace the use of finalizers with an explicit
ReferenceQueue of Go references, and the Ref class will no longer
be used for Go refences. To prepare for that, this CL pulls up the
construction of Go referencing Ref instances into the Seq.trackGoRef
function.

Change-Id: I9eefe238cd3fd1b661b2af11d331a2f61e31303b
Reviewed-on: https://go-review.googlesource.com/106875
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2018-04-17 14:58:00 +00:00

88 lines
3.7 KiB
Plaintext

// JNI functions for the Go <=> Java bridge.
// gobind -lang=java issue10788
//
// File is generated by gobind. Do not edit.
#include <android/log.h>
#include <stdint.h>
#include "seq.h"
#include "_cgo_export.h"
#include "issue10788.h"
jclass proxy_class_issue10788_TestInterface;
jmethodID proxy_class_issue10788_TestInterface_cons;
static jmethodID mid_TestInterface_DoSomeWork;
static jmethodID mid_TestInterface_MultipleUnnamedParams;
jclass proxy_class_issue10788_TestStruct;
jmethodID proxy_class_issue10788_TestStruct_cons;
JNIEXPORT void JNICALL
Java_issue10788_Issue10788__1init(JNIEnv *env, jclass _unused) {
jclass clazz;
clazz = (*env)->FindClass(env, "issue10788/TestStruct");
proxy_class_issue10788_TestStruct = (*env)->NewGlobalRef(env, clazz);
proxy_class_issue10788_TestStruct_cons = (*env)->GetMethodID(env, clazz, "<init>", "(I)V");
clazz = (*env)->FindClass(env, "issue10788/Issue10788$proxyTestInterface");
proxy_class_issue10788_TestInterface = (*env)->NewGlobalRef(env, clazz);
proxy_class_issue10788_TestInterface_cons = (*env)->GetMethodID(env, clazz, "<init>", "(I)V");
clazz = (*env)->FindClass(env, "issue10788/TestInterface");
mid_TestInterface_DoSomeWork = (*env)->GetMethodID(env, clazz, "doSomeWork", "(Lissue10788/TestStruct;)V");
mid_TestInterface_MultipleUnnamedParams = (*env)->GetMethodID(env, clazz, "multipleUnnamedParams", "(JLjava/lang/String;J)V");
}
JNIEXPORT jint JNICALL
Java_issue10788_TestStruct__1_1New(JNIEnv *env, jclass clazz) {
return new_issue10788_TestStruct();
}
JNIEXPORT void JNICALL
Java_issue10788_TestStruct_setValue(JNIEnv *env, jobject this, jstring v) {
int32_t o = go_seq_to_refnum_go(env, this);
nstring _v = go_seq_from_java_string(env, v);
proxyissue10788_TestStruct_Value_Set(o, _v);
}
JNIEXPORT jstring JNICALL
Java_issue10788_TestStruct_getValue(JNIEnv *env, jobject this) {
int32_t o = go_seq_to_refnum_go(env, this);
nstring r0 = proxyissue10788_TestStruct_Value_Get(o);
jstring _r0 = go_seq_to_java_string(env, r0);
return _r0;
}
JNIEXPORT void JNICALL
Java_issue10788_Issue10788_00024proxyTestInterface_doSomeWork(JNIEnv* env, jobject __this__, jobject s) {
int32_t o = go_seq_to_refnum_go(env, __this__);
int32_t _s = go_seq_to_refnum(env, s);
proxyissue10788_TestInterface_DoSomeWork(o, _s);
}
void cproxyissue10788_TestInterface_DoSomeWork(int32_t refnum, int32_t s) {
JNIEnv *env = go_seq_push_local_frame(1);
jobject o = go_seq_from_refnum(env, refnum, proxy_class_issue10788_TestInterface, proxy_class_issue10788_TestInterface_cons);
jobject _s = go_seq_from_refnum(env, s, proxy_class_issue10788_TestStruct, proxy_class_issue10788_TestStruct_cons);
(*env)->CallVoidMethod(env, o, mid_TestInterface_DoSomeWork, _s);
go_seq_pop_local_frame(env);
}
JNIEXPORT void JNICALL
Java_issue10788_Issue10788_00024proxyTestInterface_multipleUnnamedParams(JNIEnv* env, jobject __this__, jlong p0, jstring p1, jlong p2) {
int32_t o = go_seq_to_refnum_go(env, __this__);
nint _p0 = (nint)p0;
nstring _p1 = go_seq_from_java_string(env, p1);
int64_t _p2 = (int64_t)p2;
proxyissue10788_TestInterface_MultipleUnnamedParams(o, _p0, _p1, _p2);
}
void cproxyissue10788_TestInterface_MultipleUnnamedParams(int32_t refnum, nint p0, nstring p1, int64_t p2) {
JNIEnv *env = go_seq_push_local_frame(3);
jobject o = go_seq_from_refnum(env, refnum, proxy_class_issue10788_TestInterface, proxy_class_issue10788_TestInterface_cons);
jlong _p0 = (jlong)p0;
jstring _p1 = go_seq_to_java_string(env, p1);
jlong _p2 = (jlong)p2;
(*env)->CallVoidMethod(env, o, mid_TestInterface_MultipleUnnamedParams, _p0, _p1, _p2);
go_seq_pop_local_frame(env);
}