bind,internal/importers: always generate toString methods

When wrapping Java exceptions, their toString() methods are called from
the wrapper's Error() method to satisfy the Go error interface. Make
sure toString() is always included, even if it never directly referenced
from bound packages.

Change-Id: I5653f6ad82afbe4b061e02a69d60453000288a83
Reviewed-on: https://go-review.googlesource.com/35189
Reviewed-by: David Crawshaw <crawshaw@golang.org>
This commit is contained in:
Elias Naur
2017-01-17 14:05:11 +00:00
parent d96b6de528
commit 2f5693b8d8
9 changed files with 636 additions and 4 deletions
+10
View File
@@ -46,6 +46,10 @@ typedef struct ret_nbyteslice {
jint exc;
} ret_nbyteslice;
extern ret_nstring cproxy_java_lang_Float_toString(jint this);
extern ret_nstring cproxy_java_lang_Object_toString(jint this);
extern ret_nstring cproxy_java_lang_Character_toString(jint this);
extern ret_nstring cproxy_java_lang_Character_Subset_toString(jint this);
// JNI function headers for the Go <=> Java bridge.
// gobind -lang=java java
//
@@ -59,13 +63,19 @@ typedef struct ret_nbyteslice {
extern jclass proxy_class_java_F;
extern jmethodID proxy_class_java_F_cons;
nstring cproxyjava_F_ToString(int32_t refnum);
extern jclass proxy_class_java_O;
extern jmethodID proxy_class_java_O_cons;
nstring cproxyjava_O_ToString(int32_t refnum);
extern jclass proxy_class_java_R;
extern jmethodID proxy_class_java_R_cons;
extern jclass proxy_class_java_S;
extern jmethodID proxy_class_java_S_cons;
nstring cproxyjava_S_ToString(int32_t refnum);
#endif