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
+9 -3
View File
@@ -6,7 +6,8 @@ package java;
import go.Seq;
public interface F {
public interface F extends R {
public String toString();
}
@@ -18,7 +19,8 @@ package java;
import go.Seq;
public interface O {
public interface O extends R {
public String toString();
}
@@ -42,7 +44,8 @@ package java;
import go.Seq;
public interface S {
public interface S extends R {
public String toString();
}
@@ -78,6 +81,7 @@ public abstract class Java {
proxyF(Seq.Ref ref) { this.ref = ref; }
public native String toString();
}
private static final class proxyO implements Seq.Proxy, O {
private final Seq.Ref ref;
@@ -90,6 +94,7 @@ public abstract class Java {
proxyO(Seq.Ref ref) { this.ref = ref; }
public native String toString();
}
private static final class proxyR implements Seq.Proxy, R {
private final Seq.Ref ref;
@@ -114,6 +119,7 @@ public abstract class Java {
proxyS(Seq.Ref ref) { this.ref = ref; }
public native String toString();
}