Gobind uses strings for passing errors across the language barrier. However, since Gobind doesn't have a concept of a nil string, it can't separate an empty native string from a nil string. In turn, that means that empty errors, exceptions or NSError * with an empty description are treated as no error. With ObjC, empty errors are replaced with a default string to workaround the issue, while with Java empty errors are silently ignored. Fix this by replacing strings with actual error objects, wrapping the Go error, Java Throwable or ObjC NSError *, and letting the existing bind machinery take care of passing the references across. It's a large change for a small corner case, but I believe objects are a better fit for exception that strings. Error objects also naturally leads to future additions, for example accessing the exception class name or chained exception. Change-Id: Ie03b47cafcb231ad1e12a80195693fa7459c6265 Reviewed-on: https://go-review.googlesource.com/24100 Reviewed-by: David Crawshaw <crawshaw@golang.org>
54 lines
1.4 KiB
Plaintext
54 lines
1.4 KiB
Plaintext
// JNI function headers for the Go <=> Java bridge.
|
|
// gobind -lang=java interfaces
|
|
//
|
|
// File is generated by gobind. Do not edit.
|
|
|
|
#ifndef __Interfaces_H__
|
|
#define __Interfaces_H__
|
|
|
|
#include <jni.h>
|
|
|
|
extern jclass proxy_class_interfaces_Error;
|
|
extern jmethodID proxy_class_interfaces_Error_cons;
|
|
|
|
int32_t cproxyinterfaces_Error_Err(int32_t refnum);
|
|
|
|
extern jclass proxy_class_interfaces_I;
|
|
extern jmethodID proxy_class_interfaces_I_cons;
|
|
|
|
int32_t cproxyinterfaces_I_Rand(int32_t refnum);
|
|
|
|
extern jclass proxy_class_interfaces_I1;
|
|
extern jmethodID proxy_class_interfaces_I1_cons;
|
|
|
|
void cproxyinterfaces_I1_J(int32_t refnum);
|
|
|
|
extern jclass proxy_class_interfaces_I2;
|
|
extern jmethodID proxy_class_interfaces_I2_cons;
|
|
|
|
void cproxyinterfaces_I2_G(int32_t refnum);
|
|
|
|
extern jclass proxy_class_interfaces_I3;
|
|
extern jmethodID proxy_class_interfaces_I3_cons;
|
|
|
|
int32_t cproxyinterfaces_I3_F(int32_t refnum);
|
|
|
|
extern jclass proxy_class_interfaces_LargerI;
|
|
extern jmethodID proxy_class_interfaces_LargerI_cons;
|
|
|
|
void cproxyinterfaces_LargerI_AnotherFunc(int32_t refnum);
|
|
|
|
int32_t cproxyinterfaces_LargerI_Rand(int32_t refnum);
|
|
|
|
extern jclass proxy_class_interfaces_SameI;
|
|
extern jmethodID proxy_class_interfaces_SameI_cons;
|
|
|
|
int32_t cproxyinterfaces_SameI_Rand(int32_t refnum);
|
|
|
|
extern jclass proxy_class_interfaces_WithParam;
|
|
extern jmethodID proxy_class_interfaces_WithParam_cons;
|
|
|
|
void cproxyinterfaces_WithParam_HasParam(int32_t refnum, char p0);
|
|
|
|
#endif
|