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>
43 lines
1.2 KiB
Plaintext
43 lines
1.2 KiB
Plaintext
// JNI functions for the Go <=> Java bridge.
|
|
// gobind -lang=java issue12328
|
|
//
|
|
// File is generated by gobind. Do not edit.
|
|
|
|
#include <android/log.h>
|
|
#include <stdint.h>
|
|
#include "seq.h"
|
|
#include "_cgo_export.h"
|
|
#include "issue12328.h"
|
|
|
|
jclass proxy_class_issue12328_T;
|
|
jmethodID proxy_class_issue12328_T_cons;
|
|
|
|
JNIEXPORT void JNICALL
|
|
Java_issue12328_Issue12328__1init(JNIEnv *env, jclass _unused) {
|
|
jclass clazz;
|
|
clazz = (*env)->FindClass(env, "issue12328/T");
|
|
proxy_class_issue12328_T = (*env)->NewGlobalRef(env, clazz);
|
|
proxy_class_issue12328_T_cons = (*env)->GetMethodID(env, clazz, "<init>", "(I)V");
|
|
}
|
|
|
|
JNIEXPORT jint JNICALL
|
|
Java_issue12328_T__1_1New(JNIEnv *env, jclass clazz) {
|
|
return new_issue12328_T();
|
|
}
|
|
|
|
JNIEXPORT void JNICALL
|
|
Java_issue12328_T_setErr(JNIEnv *env, jobject this, jobject v) {
|
|
int32_t o = go_seq_to_refnum_go(env, this);
|
|
int32_t _v = go_seq_to_refnum(env, v);
|
|
proxyissue12328_T_Err_Set(o, _v);
|
|
}
|
|
|
|
JNIEXPORT jobject JNICALL
|
|
Java_issue12328_T_getErr(JNIEnv *env, jobject this) {
|
|
int32_t o = go_seq_to_refnum_go(env, this);
|
|
int32_t r0 = proxyissue12328_T_Err_Get(o);
|
|
jobject _r0 = go_seq_from_refnum(env, r0, proxy_class__error, proxy_class__error_cons);
|
|
return _r0;
|
|
}
|
|
|