mirror of
https://github.com/netbirdio/gomobile-tvos-fork.git
synced 2026-05-22 18:43:29 -07:00
mobile/bind: move generated Java classes to package level
Before this CL, generated Java classes or interfaces were inner
classes to the top package class. That is both unnecessary and creates
ugly class names. Instead, move every generated class and interface to its
own package level class.
NOTE: This is a backwards incompatible change and requires every client
of gomobile APIs to be updated to leave out the package class in the
type names. For example, the Go type
package pkg
type S struct {
}
now generates (with the default java package name go) a Java class named
go.pkg.S. The name before this CL was go.pkg.Pkg.S.
Also, change the custom java package to specify the package prefix and
not the full package as before. This is an unfortunate change needed
to avoid name clashes between two bound packages. On the plus side,
the change brings the custom package case closer to the default behaviour,
which is a commen prefix, "go.", and a distinct java package for every
Go package bound.
Change-Id: Iadfaad56e101d1caf7e2a05006f4d384859a20fe
Reviewed-on: https://go-review.googlesource.com/27436
Reviewed-by: David Crawshaw <crawshaw@golang.org>
This commit is contained in:
@@ -13,16 +13,16 @@ import java.util.HashMap;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
|
||||
import go.benchmark.Benchmark;
|
||||
import go.benchmark.*;
|
||||
|
||||
public class SeqBench extends InstrumentationTestCase {
|
||||
|
||||
public static class AnI implements Benchmark.I {
|
||||
public static class AnI implements I {
|
||||
@Override public void F() {
|
||||
}
|
||||
}
|
||||
|
||||
private static class Benchmarks implements Benchmark.Benchmarks {
|
||||
private static class Benchmarks implements go.benchmark.Benchmarks {
|
||||
private static Map<String, Runnable> benchmarks;
|
||||
private static ExecutorService executor = Executors.newSingleThreadExecutor();
|
||||
|
||||
@@ -52,13 +52,13 @@ public class SeqBench extends InstrumentationTestCase {
|
||||
Benchmark.Oneret();
|
||||
}
|
||||
});
|
||||
final Benchmark.I javaRef = new AnI();
|
||||
final I javaRef = new AnI();
|
||||
benchmarks.put("Refforeign", new Runnable() {
|
||||
@Override public void run() {
|
||||
Benchmark.Ref(javaRef);
|
||||
}
|
||||
});
|
||||
final Benchmark.I goRef = Benchmark.NewI();
|
||||
final I goRef = Benchmark.NewI();
|
||||
benchmarks.put("Refgo", new Runnable() {
|
||||
@Override public void run() {
|
||||
Benchmark.Ref(goRef);
|
||||
@@ -130,10 +130,10 @@ public class SeqBench extends InstrumentationTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
@Override public Benchmark.I NewI() {
|
||||
@Override public I NewI() {
|
||||
return new AnI();
|
||||
}
|
||||
@Override public void Ref(Benchmark.I i) {
|
||||
@Override public void Ref(I i) {
|
||||
}
|
||||
@Override public void Noargs() {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user