bind: error for packages with no exported names.

For error message improvement mentioned in golang/go#12842

Change-Id: I066ae9dc9415b34bf93128098199bbb935b7dedc
Reviewed-on: https://go-review.googlesource.com/15410
Reviewed-by: David Crawshaw <crawshaw@golang.org>
This commit is contained in:
Hyang-Ah (Hana) Kim
2015-10-07 20:50:02 +00:00
committed by Hyang-Ah Hana Kim
parent 45ed283c80
commit bb506cefe4
3 changed files with 16 additions and 0 deletions
+5
View File
@@ -668,11 +668,13 @@ func (g *javaGen) gen() error {
scope := g.pkg.Scope()
names := scope.Names()
hasExported := false
for _, name := range names {
obj := scope.Lookup(name)
if !obj.Exported() {
continue
}
hasExported = true
switch o := obj.(type) {
// TODO(crawshaw): case *types.Var:
@@ -700,6 +702,9 @@ func (g *javaGen) gen() error {
g.errorf("unsupported exported type: %T", obj)
}
}
if !hasExported {
g.errorf("no exported names in the package %q", g.pkg.Path())
}
for i, name := range funcs {
g.Printf("private static final int CALL_%s = %d;\n", name, i+1)