Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bind,internal/importers: add Unwrap methods to unwrap Java wrappers
For Java classes implemented in Go, it is useful to take a Java instance and extract its wrapped Go instance. For example, consider the java.lang.Runnable implementation wrapping a Go function: package somepkg type GoRunnable struct { lang.Runnable f func() } Java methods that take a java.lang.Runnable cannot directly take a *GoRunnable, so this CL adds a Unwrap method: import gorun "Java/somepkg/GoRunnable" ... r := gorun.New() r.Unwrap().(*GoRunnable).f = func() { ... } javapkg.Run(r) The extra interface conversion is unfortunately needed to avoid import cycles. Change-Id: Ib775a5712cd25aa75a19d364a55d76b1e11dce77 Reviewed-on: https://go-review.googlesource.com/35295 Reviewed-by: David Crawshaw <crawshaw@golang.org>
- Loading branch information
Elias Naur
committed
Jan 18, 2017
1 parent
a0f998b
commit c243211
Showing
13 changed files
with
142 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.