Accept Java API interface types as arguments and return values from bound Go package functions and methods. Also, allow Go structs to extend Java classes and implement Java interfaces as well as override and implement methods. This is the third and final part of the implementation of the golang/go#16876 proposal. Fixes golang/go#16876 Change-Id: I6951dd87235553ce09abe5117a39a503466163c0 Reviewed-on: https://go-review.googlesource.com/28597 Reviewed-by: David Crawshaw <crawshaw@golang.org>
61 lines
1.9 KiB
Plaintext
61 lines
1.9 KiB
Plaintext
// JNI functions for the Go <=> Java bridge.
|
|
// gobind -lang=java basictypes
|
|
//
|
|
// File is generated by gobind. Do not edit.
|
|
|
|
#include <android/log.h>
|
|
#include <stdint.h>
|
|
#include "seq.h"
|
|
#include "_cgo_export.h"
|
|
#include "basictypes.h"
|
|
|
|
|
|
JNIEXPORT void JNICALL
|
|
Java_go_basictypes_Basictypes__1init(JNIEnv *env, jclass _unused) {
|
|
jclass clazz;
|
|
}
|
|
|
|
JNIEXPORT jboolean JNICALL
|
|
Java_go_basictypes_Basictypes_bool(JNIEnv* env, jclass _clazz, jboolean p0) {
|
|
char _p0 = (char)p0;
|
|
char r0 = proxybasictypes__Bool(_p0);
|
|
jboolean _r0 = r0 ? JNI_TRUE : JNI_FALSE;
|
|
return _r0;
|
|
}
|
|
|
|
JNIEXPORT jbyteArray JNICALL
|
|
Java_go_basictypes_Basictypes_byteArrays(JNIEnv* env, jclass _clazz, jbyteArray x) {
|
|
nbyteslice _x = go_seq_from_java_bytearray(env, x, 0);
|
|
nbyteslice r0 = proxybasictypes__ByteArrays(_x);
|
|
go_seq_release_byte_array(env, x, _x.ptr);
|
|
jbyteArray _r0 = go_seq_to_java_bytearray(env, r0, 1);
|
|
return _r0;
|
|
}
|
|
|
|
JNIEXPORT void JNICALL
|
|
Java_go_basictypes_Basictypes_error(JNIEnv* env, jclass _clazz) {
|
|
int32_t r0 = proxybasictypes__Error();
|
|
jobject _r0 = go_seq_from_refnum(env, r0, proxy_class__error, proxy_class__error_cons);
|
|
go_seq_maybe_throw_exception(env, _r0);
|
|
}
|
|
|
|
JNIEXPORT jlong JNICALL
|
|
Java_go_basictypes_Basictypes_errorPair(JNIEnv* env, jclass _clazz) {
|
|
struct proxybasictypes__ErrorPair_return res = proxybasictypes__ErrorPair();
|
|
jlong _r0 = (jlong)res.r0;
|
|
jobject _r1 = go_seq_from_refnum(env, res.r1, proxy_class__error, proxy_class__error_cons);
|
|
go_seq_maybe_throw_exception(env, _r1);
|
|
return _r0;
|
|
}
|
|
|
|
JNIEXPORT void JNICALL
|
|
Java_go_basictypes_Basictypes_ints(JNIEnv* env, jclass _clazz, jbyte x, jshort y, jint z, jlong t, jlong u) {
|
|
int8_t _x = (int8_t)x;
|
|
int16_t _y = (int16_t)y;
|
|
int32_t _z = (int32_t)z;
|
|
int64_t _t = (int64_t)t;
|
|
nint _u = (nint)u;
|
|
proxybasictypes__Ints(_x, _y, _z, _t, _u);
|
|
}
|
|
|