The ClassGen.genGo function always uses unsafe, contrary to what the check in GenGo says. With this CL, generated code always imports unsafe if there are any classes to be generated. Change-Id: Ic807111a26e494b4941790830b1950bb8b1f73d5 Reviewed-on: https://go-review.googlesource.com/29873 Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
466 lines
12 KiB
Plaintext
466 lines
12 KiB
Plaintext
// File is generated by gobind. Do not edit.
|
|
|
|
package Java
|
|
|
|
// Used to silence this package not used errors
|
|
const Dummy = 0
|
|
|
|
type Java_lang_Runnable interface {
|
|
Run()
|
|
}
|
|
|
|
type Java_io_InputStream interface {
|
|
Read() (int32, error)
|
|
Super() Java_io_InputStream
|
|
}
|
|
|
|
type Java_util_concurrent_Future interface {
|
|
Get() (Java_lang_Object, error)
|
|
Get2(a0 int64, a1 Java_util_concurrent_TimeUnit) (Java_lang_Object, error)
|
|
}
|
|
|
|
type Java_lang_Object interface {
|
|
Super() Java_lang_Object
|
|
}
|
|
|
|
type Java_util_concurrent_TimeUnit interface {
|
|
Super() Java_util_concurrent_TimeUnit
|
|
}
|
|
|
|
// File is generated by gobind. Do not edit.
|
|
|
|
package gomobile_bind
|
|
|
|
/*
|
|
#include <stdlib.h> // for free()
|
|
#include <jni.h>
|
|
#include "seq.h"
|
|
#include "classes.h"
|
|
*/
|
|
import "C"
|
|
|
|
import (
|
|
"Java"
|
|
_seq "golang.org/x/mobile/bind/seq"
|
|
)
|
|
|
|
import "unsafe"
|
|
|
|
type proxy interface { Bind_proxy_refnum__() int32 }
|
|
|
|
// Suppress unused package error
|
|
|
|
var _ = _seq.FromRefNum
|
|
const _ = Java.Dummy
|
|
|
|
//export initClasses
|
|
func initClasses() {
|
|
C.init_proxies()
|
|
init_java_lang_Runnable()
|
|
init_java_io_InputStream()
|
|
init_java_util_concurrent_Future()
|
|
init_java_lang_Object()
|
|
init_java_util_concurrent_TimeUnit()
|
|
}
|
|
|
|
func init_java_lang_Runnable() {
|
|
cls := C.CString("java/lang/Runnable")
|
|
clazz := C.go_seq_find_class(cls)
|
|
C.free(unsafe.Pointer(cls))
|
|
if clazz == nil {
|
|
return
|
|
}
|
|
}
|
|
|
|
type proxy_class_java_lang_Runnable _seq.Ref
|
|
|
|
func (p *proxy_class_java_lang_Runnable) Bind_proxy_refnum__() int32 { return (*_seq.Ref)(p).Bind_IncNum() }
|
|
|
|
func (p *proxy_class_java_lang_Runnable) Run() {
|
|
res := C.cproxy_java_lang_Runnable_run(C.jint(p.Bind_proxy_refnum__()))
|
|
var _exc error
|
|
_exc_ref := _seq.FromRefNum(int32(res))
|
|
if _exc_ref != nil {
|
|
if res < 0 { // go object
|
|
_exc = _exc_ref.Get().(error)
|
|
} else { // foreign object
|
|
_exc = (*proxy_error)(_exc_ref)
|
|
}
|
|
}
|
|
if (_exc != nil) { panic(_exc) }
|
|
}
|
|
|
|
func init_java_io_InputStream() {
|
|
cls := C.CString("java/io/InputStream")
|
|
clazz := C.go_seq_find_class(cls)
|
|
C.free(unsafe.Pointer(cls))
|
|
if clazz == nil {
|
|
return
|
|
}
|
|
}
|
|
|
|
type proxy_class_java_io_InputStream _seq.Ref
|
|
|
|
func (p *proxy_class_java_io_InputStream) Bind_proxy_refnum__() int32 { return (*_seq.Ref)(p).Bind_IncNum() }
|
|
|
|
func (p *proxy_class_java_io_InputStream) Read() (int32, error) {
|
|
res := C.cproxy_java_io_InputStream_read__(C.jint(p.Bind_proxy_refnum__()))
|
|
_res := int32(res.res)
|
|
var _exc error
|
|
_exc_ref := _seq.FromRefNum(int32(res.exc))
|
|
if _exc_ref != nil {
|
|
if res.exc < 0 { // go object
|
|
_exc = _exc_ref.Get().(error)
|
|
} else { // foreign object
|
|
_exc = (*proxy_error)(_exc_ref)
|
|
}
|
|
}
|
|
return _res, _exc
|
|
}
|
|
|
|
func (p *proxy_class_java_io_InputStream) Super() Java.Java_io_InputStream {
|
|
return &super_java_io_InputStream{p}
|
|
}
|
|
|
|
type super_java_io_InputStream struct {*proxy_class_java_io_InputStream}
|
|
|
|
func (p *super_java_io_InputStream) Read() (int32, error) {
|
|
res := C.csuper_java_io_InputStream_read__(C.jint(p.Bind_proxy_refnum__()))
|
|
_res := int32(res.res)
|
|
var _exc error
|
|
_exc_ref := _seq.FromRefNum(int32(res.exc))
|
|
if _exc_ref != nil {
|
|
if res.exc < 0 { // go object
|
|
_exc = _exc_ref.Get().(error)
|
|
} else { // foreign object
|
|
_exc = (*proxy_error)(_exc_ref)
|
|
}
|
|
}
|
|
return _res, _exc
|
|
}
|
|
|
|
func init_java_util_concurrent_Future() {
|
|
cls := C.CString("java/util/concurrent/Future")
|
|
clazz := C.go_seq_find_class(cls)
|
|
C.free(unsafe.Pointer(cls))
|
|
if clazz == nil {
|
|
return
|
|
}
|
|
}
|
|
|
|
type proxy_class_java_util_concurrent_Future _seq.Ref
|
|
|
|
func (p *proxy_class_java_util_concurrent_Future) Bind_proxy_refnum__() int32 { return (*_seq.Ref)(p).Bind_IncNum() }
|
|
|
|
func (p *proxy_class_java_util_concurrent_Future) Get() (Java.Java_lang_Object, error) {
|
|
res := C.cproxy_java_util_concurrent_Future_get__(C.jint(p.Bind_proxy_refnum__()))
|
|
var _res Java.Java_lang_Object
|
|
_res_ref := _seq.FromRefNum(int32(res.res))
|
|
if _res_ref != nil {
|
|
if res.res < 0 { // go object
|
|
_res = _res_ref.Get().(Java.Java_lang_Object)
|
|
} else { // foreign object
|
|
_res = (*proxy_class_java_lang_Object)(_res_ref)
|
|
}
|
|
}
|
|
var _exc error
|
|
_exc_ref := _seq.FromRefNum(int32(res.exc))
|
|
if _exc_ref != nil {
|
|
if res.exc < 0 { // go object
|
|
_exc = _exc_ref.Get().(error)
|
|
} else { // foreign object
|
|
_exc = (*proxy_error)(_exc_ref)
|
|
}
|
|
}
|
|
return _res, _exc
|
|
}
|
|
|
|
func (p *proxy_class_java_util_concurrent_Future) Get2(a0 int64, a1 Java.Java_util_concurrent_TimeUnit) (Java.Java_lang_Object, error) {
|
|
_a0 := C.jlong(a0)
|
|
var _a1 C.jint = _seq.NullRefNum
|
|
if a1 != nil {
|
|
_a1 = C.jint(_seq.ToRefNum(a1))
|
|
}
|
|
res := C.cproxy_java_util_concurrent_Future_get__JLjava_util_concurrent_TimeUnit_2(C.jint(p.Bind_proxy_refnum__()), _a0, _a1)
|
|
var _res Java.Java_lang_Object
|
|
_res_ref := _seq.FromRefNum(int32(res.res))
|
|
if _res_ref != nil {
|
|
if res.res < 0 { // go object
|
|
_res = _res_ref.Get().(Java.Java_lang_Object)
|
|
} else { // foreign object
|
|
_res = (*proxy_class_java_lang_Object)(_res_ref)
|
|
}
|
|
}
|
|
var _exc error
|
|
_exc_ref := _seq.FromRefNum(int32(res.exc))
|
|
if _exc_ref != nil {
|
|
if res.exc < 0 { // go object
|
|
_exc = _exc_ref.Get().(error)
|
|
} else { // foreign object
|
|
_exc = (*proxy_error)(_exc_ref)
|
|
}
|
|
}
|
|
return _res, _exc
|
|
}
|
|
|
|
func init_java_lang_Object() {
|
|
cls := C.CString("java/lang/Object")
|
|
clazz := C.go_seq_find_class(cls)
|
|
C.free(unsafe.Pointer(cls))
|
|
if clazz == nil {
|
|
return
|
|
}
|
|
}
|
|
|
|
type proxy_class_java_lang_Object _seq.Ref
|
|
|
|
func (p *proxy_class_java_lang_Object) Bind_proxy_refnum__() int32 { return (*_seq.Ref)(p).Bind_IncNum() }
|
|
|
|
func (p *proxy_class_java_lang_Object) Super() Java.Java_lang_Object {
|
|
return &super_java_lang_Object{p}
|
|
}
|
|
|
|
type super_java_lang_Object struct {*proxy_class_java_lang_Object}
|
|
|
|
func init_java_util_concurrent_TimeUnit() {
|
|
cls := C.CString("java/util/concurrent/TimeUnit")
|
|
clazz := C.go_seq_find_class(cls)
|
|
C.free(unsafe.Pointer(cls))
|
|
if clazz == nil {
|
|
return
|
|
}
|
|
}
|
|
|
|
type proxy_class_java_util_concurrent_TimeUnit _seq.Ref
|
|
|
|
func (p *proxy_class_java_util_concurrent_TimeUnit) Bind_proxy_refnum__() int32 { return (*_seq.Ref)(p).Bind_IncNum() }
|
|
|
|
func (p *proxy_class_java_util_concurrent_TimeUnit) Super() Java.Java_util_concurrent_TimeUnit {
|
|
return &super_java_util_concurrent_TimeUnit{p}
|
|
}
|
|
|
|
type super_java_util_concurrent_TimeUnit struct {*proxy_class_java_util_concurrent_TimeUnit}
|
|
|
|
// Package gomobile_bind is an autogenerated binder stub for package java.
|
|
// gobind -lang=go classes
|
|
//
|
|
// File is generated by gobind. Do not edit.
|
|
package gomobile_bind
|
|
|
|
/*
|
|
#include <stdlib.h>
|
|
#include <stdint.h>
|
|
#include "seq.h"
|
|
#include "java.h"
|
|
|
|
*/
|
|
import "C"
|
|
|
|
import (
|
|
"Java/java/io"
|
|
"Java/java/lang"
|
|
"Java/java/util/concurrent"
|
|
"classes"
|
|
_seq "golang.org/x/mobile/bind/seq"
|
|
)
|
|
|
|
// suppress the error if seq ends up unused
|
|
var _ = _seq.FromRefNum
|
|
|
|
//export proxyjava_Future_Future_Set
|
|
func proxyjava_Future_Future_Set(refnum C.int32_t, v C.int32_t) {
|
|
ref := _seq.FromRefNum(int32(refnum))
|
|
var _v concurrent.Future
|
|
_v_ref := _seq.FromRefNum(int32(v))
|
|
if _v_ref != nil {
|
|
if v < 0 { // go object
|
|
_v = _v_ref.Get().(concurrent.Future)
|
|
} else { // foreign object
|
|
_v = (*proxy_class_java_util_concurrent_Future)(_v_ref)
|
|
}
|
|
}
|
|
ref.Get().(*java.Future).Future = _v
|
|
}
|
|
|
|
//export proxyjava_Future_Future_Get
|
|
func proxyjava_Future_Future_Get(refnum C.int32_t) C.int32_t {
|
|
ref := _seq.FromRefNum(int32(refnum))
|
|
v := ref.Get().(*java.Future).Future
|
|
var _v C.int32_t = _seq.NullRefNum
|
|
if v != nil {
|
|
_v = C.int32_t(_seq.ToRefNum(v))
|
|
}
|
|
return _v
|
|
}
|
|
|
|
//export proxyjava_Future_Get
|
|
func proxyjava_Future_Get(refnum C.int32_t) C.int32_t {
|
|
ref := _seq.FromRefNum(int32(refnum))
|
|
v := ref.Get().(*java.Future)
|
|
res_0 := v.Get()
|
|
var _res_0 C.int32_t = _seq.NullRefNum
|
|
if res_0 != nil {
|
|
_res_0 = C.int32_t(_seq.ToRefNum(res_0))
|
|
}
|
|
return _res_0
|
|
}
|
|
|
|
//export proxyjava_Future_Get2
|
|
func proxyjava_Future_Get2(refnum C.int32_t, param_p0 C.int64_t, param_p1 C.int32_t) C.int32_t {
|
|
ref := _seq.FromRefNum(int32(refnum))
|
|
v := ref.Get().(*java.Future)
|
|
_param_p0 := int64(param_p0)
|
|
var _param_p1 concurrent.TimeUnit
|
|
_param_p1_ref := _seq.FromRefNum(int32(param_p1))
|
|
if _param_p1_ref != nil {
|
|
if param_p1 < 0 { // go object
|
|
_param_p1 = _param_p1_ref.Get().(concurrent.TimeUnit)
|
|
} else { // foreign object
|
|
_param_p1 = (*proxy_class_java_util_concurrent_TimeUnit)(_param_p1_ref)
|
|
}
|
|
}
|
|
res_0 := v.Get2(_param_p0, _param_p1)
|
|
var _res_0 C.int32_t = _seq.NullRefNum
|
|
if res_0 != nil {
|
|
_res_0 = C.int32_t(_seq.ToRefNum(res_0))
|
|
}
|
|
return _res_0
|
|
}
|
|
|
|
//export new_java_Future
|
|
func new_java_Future() C.int32_t {
|
|
return C.int32_t(_seq.ToRefNum(new(java.Future)))
|
|
}
|
|
|
|
//export proxyjava_InputStream_InputStream_Set
|
|
func proxyjava_InputStream_InputStream_Set(refnum C.int32_t, v C.int32_t) {
|
|
ref := _seq.FromRefNum(int32(refnum))
|
|
var _v io.InputStream
|
|
_v_ref := _seq.FromRefNum(int32(v))
|
|
if _v_ref != nil {
|
|
if v < 0 { // go object
|
|
_v = _v_ref.Get().(io.InputStream)
|
|
} else { // foreign object
|
|
_v = (*proxy_class_java_io_InputStream)(_v_ref)
|
|
}
|
|
}
|
|
ref.Get().(*java.InputStream).InputStream = _v
|
|
}
|
|
|
|
//export proxyjava_InputStream_InputStream_Get
|
|
func proxyjava_InputStream_InputStream_Get(refnum C.int32_t) C.int32_t {
|
|
ref := _seq.FromRefNum(int32(refnum))
|
|
v := ref.Get().(*java.InputStream).InputStream
|
|
var _v C.int32_t = _seq.NullRefNum
|
|
if v != nil {
|
|
_v = C.int32_t(_seq.ToRefNum(v))
|
|
}
|
|
return _v
|
|
}
|
|
|
|
//export proxyjava_InputStream_Read
|
|
func proxyjava_InputStream_Read(refnum C.int32_t) (C.int32_t, C.int32_t) {
|
|
ref := _seq.FromRefNum(int32(refnum))
|
|
v := ref.Get().(*java.InputStream)
|
|
res_0, res_1 := v.Read()
|
|
_res_0 := C.int32_t(res_0)
|
|
var _res_1 C.int32_t = _seq.NullRefNum
|
|
if res_1 != nil {
|
|
_res_1 = C.int32_t(_seq.ToRefNum(res_1))
|
|
}
|
|
return _res_0, _res_1
|
|
}
|
|
|
|
//export new_java_InputStream
|
|
func new_java_InputStream() C.int32_t {
|
|
return C.int32_t(_seq.ToRefNum(new(java.InputStream)))
|
|
}
|
|
|
|
//export proxyjava_Object_Object_Set
|
|
func proxyjava_Object_Object_Set(refnum C.int32_t, v C.int32_t) {
|
|
ref := _seq.FromRefNum(int32(refnum))
|
|
var _v lang.Object
|
|
_v_ref := _seq.FromRefNum(int32(v))
|
|
if _v_ref != nil {
|
|
if v < 0 { // go object
|
|
_v = _v_ref.Get().(lang.Object)
|
|
} else { // foreign object
|
|
_v = (*proxy_class_java_lang_Object)(_v_ref)
|
|
}
|
|
}
|
|
ref.Get().(*java.Object).Object = _v
|
|
}
|
|
|
|
//export proxyjava_Object_Object_Get
|
|
func proxyjava_Object_Object_Get(refnum C.int32_t) C.int32_t {
|
|
ref := _seq.FromRefNum(int32(refnum))
|
|
v := ref.Get().(*java.Object).Object
|
|
var _v C.int32_t = _seq.NullRefNum
|
|
if v != nil {
|
|
_v = C.int32_t(_seq.ToRefNum(v))
|
|
}
|
|
return _v
|
|
}
|
|
|
|
//export new_java_Object
|
|
func new_java_Object() C.int32_t {
|
|
return C.int32_t(_seq.ToRefNum(new(java.Object)))
|
|
}
|
|
|
|
//export proxyjava_Runnable_Runnable_Set
|
|
func proxyjava_Runnable_Runnable_Set(refnum C.int32_t, v C.int32_t) {
|
|
ref := _seq.FromRefNum(int32(refnum))
|
|
var _v lang.Runnable
|
|
_v_ref := _seq.FromRefNum(int32(v))
|
|
if _v_ref != nil {
|
|
if v < 0 { // go object
|
|
_v = _v_ref.Get().(lang.Runnable)
|
|
} else { // foreign object
|
|
_v = (*proxy_class_java_lang_Runnable)(_v_ref)
|
|
}
|
|
}
|
|
ref.Get().(*java.Runnable).Runnable = _v
|
|
}
|
|
|
|
//export proxyjava_Runnable_Runnable_Get
|
|
func proxyjava_Runnable_Runnable_Get(refnum C.int32_t) C.int32_t {
|
|
ref := _seq.FromRefNum(int32(refnum))
|
|
v := ref.Get().(*java.Runnable).Runnable
|
|
var _v C.int32_t = _seq.NullRefNum
|
|
if v != nil {
|
|
_v = C.int32_t(_seq.ToRefNum(v))
|
|
}
|
|
return _v
|
|
}
|
|
|
|
//export proxyjava_Runnable_Run
|
|
func proxyjava_Runnable_Run(refnum C.int32_t, param_this C.int32_t) {
|
|
ref := _seq.FromRefNum(int32(refnum))
|
|
v := ref.Get().(*java.Runnable)
|
|
var _param_this lang.Runnable
|
|
_param_this_ref := _seq.FromRefNum(int32(param_this))
|
|
if _param_this_ref != nil {
|
|
if param_this < 0 { // go object
|
|
_param_this = _param_this_ref.Get().(lang.Runnable)
|
|
} else { // foreign object
|
|
_param_this = (*proxy_class_java_lang_Runnable)(_param_this_ref)
|
|
}
|
|
}
|
|
v.Run(_param_this)
|
|
}
|
|
|
|
//export new_java_Runnable
|
|
func new_java_Runnable() C.int32_t {
|
|
return C.int32_t(_seq.ToRefNum(new(java.Runnable)))
|
|
}
|
|
|
|
//export proxyjava__NewInputStream
|
|
func proxyjava__NewInputStream() C.int32_t {
|
|
res_0 := java.NewInputStream()
|
|
var _res_0 C.int32_t = _seq.NullRefNum
|
|
if res_0 != nil {
|
|
_res_0 = C.int32_t(_seq.ToRefNum(res_0))
|
|
}
|
|
return _res_0
|
|
}
|