Multiple packages are already supported, but only as if each packages were bound in isolation. This CL lets a bound package refer to other bound packages in its exported functions, types and fields. In Java, the JNI class jclass and constructor jmethodID are exported so other packages can construct proxies of other packages' interfaces. In ObjC, the class @interface declarations are moved from the package .m file to its .h file to allow other packages to constructs its interface proxies. Add a supporting test package, secondpkg, and add Java and ObjC tests for the new cross package functionality. Also add simplepkg for testing corner cases where the generated Go file must not include its bound package. While we're here, stop generating Go proxy types for struct types; only Go interfaces can be implemented in the foreign language. Change-Id: Icbfa739c893703867d38a9100ed0928fbd7a660d Reviewed-on: https://go-review.googlesource.com/20575 Reviewed-by: David Crawshaw <crawshaw@golang.org>
17 lines
549 B
Go
17 lines
549 B
Go
// Copyright 2016 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
// Package simplepkg is imported from testpkg and tests two
|
|
// corner cases.
|
|
// First: simplepkg itself contains no (exported) functions
|
|
// or methods and so its generated Go package must not import
|
|
// it.
|
|
//
|
|
// Second: even though testpkg imports simplepkg, testpkg's
|
|
// generated Go package ends up not referencing simplepkg and
|
|
// must not import it.
|
|
package simplepkg
|
|
|
|
type S struct{}
|