bind: rename parameter p
Fixes golang/go#11064.
Change-Id: Idb4376f0143b0d1c8e87e7ccc54aae343b504e4a
Reviewed-on: https://go-review.googlesource.com/10689
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
diff --git a/bind/genjava.go b/bind/genjava.go
index 7328382..371955d 100644
--- a/bind/genjava.go
+++ b/bind/genjava.go
@@ -385,7 +385,7 @@
}
}
-var paramRE = regexp.MustCompile(`^p[0-9]+$`)
+var paramRE = regexp.MustCompile(`^p[0-9]*$`)
// paramName replaces incompatible name with a p0-pN name.
// Missing names, or existing names of the form p[0-9] are incompatible.
diff --git a/bind/testdata/interfaces.go b/bind/testdata/interfaces.go
index 0e7ad7a..fcfed00 100644
--- a/bind/testdata/interfaces.go
+++ b/bind/testdata/interfaces.go
@@ -19,3 +19,7 @@
func (seven) Rand() int32 { return 7 }
func Seven() I { return seven{} }
+
+type WithParam interface {
+ HasParam(p bool)
+}
diff --git a/bind/testdata/interfaces.go.golden b/bind/testdata/interfaces.go.golden
index 6bb1050..340de12 100644
--- a/bind/testdata/interfaces.go.golden
+++ b/bind/testdata/interfaces.go.golden
@@ -51,6 +51,30 @@
out.WriteGoRef(res)
}
+const (
+ proxyWithParam_Descriptor = "go.interfaces.WithParam"
+ proxyWithParam_HasParam_Code = 0x10a
+)
+
+func proxyWithParam_HasParam(out, in *seq.Buffer) {
+ ref := in.ReadRef()
+ v := ref.Get().(interfaces.WithParam)
+ param_p0 := in.ReadBool()
+ v.HasParam(param_p0)
+}
+
+func init() {
+ seq.Register(proxyWithParam_Descriptor, proxyWithParam_HasParam_Code, proxyWithParam_HasParam)
+}
+
+type proxyWithParam seq.Ref
+
+func (p *proxyWithParam) HasParam(p0 bool) {
+ in := new(seq.Buffer)
+ in.WriteBool(p0)
+ seq.Transact((*seq.Ref)(p), proxyWithParam_HasParam_Code, in)
+}
+
func init() {
seq.Register("interfaces", 1, proxy_Add3)
seq.Register("interfaces", 2, proxy_Seven)
diff --git a/bind/testdata/interfaces.java.golden b/bind/testdata/interfaces.java.golden
index 50019f2..862f9cb 100644
--- a/bind/testdata/interfaces.java.golden
+++ b/bind/testdata/interfaces.java.golden
@@ -81,6 +81,58 @@
return _result;
}
+ public interface WithParam extends go.Seq.Object {
+ public void HasParam(boolean p0);
+
+ public static abstract class Stub implements WithParam {
+ static final String DESCRIPTOR = "go.interfaces.WithParam";
+
+ private final go.Seq.Ref ref;
+ public Stub() {
+ ref = go.Seq.createRef(this);
+ }
+
+ public go.Seq.Ref ref() { return ref; }
+
+ public void call(int code, go.Seq in, go.Seq out) {
+ switch (code) {
+ case Proxy.CALL_HasParam: {
+ boolean param_p0;
+ param_p0 = in.readBool();
+ this.HasParam(param_p0);
+ return;
+ }
+ default:
+ throw new RuntimeException("unknown code: "+ code);
+ }
+ }
+ }
+
+ static final class Proxy implements WithParam {
+ static final String DESCRIPTOR = Stub.DESCRIPTOR;
+
+ private go.Seq.Ref ref;
+
+ Proxy(go.Seq.Ref ref) { this.ref = ref; }
+
+ public go.Seq.Ref ref() { return ref; }
+
+ public void call(int code, go.Seq in, go.Seq out) {
+ throw new RuntimeException("cycle: cannot call proxy");
+ }
+
+ public void HasParam(boolean p0) {
+ go.Seq _in = new go.Seq();
+ go.Seq _out = new go.Seq();
+ _in.writeRef(ref);
+ _in.writeBool(p0);
+ Seq.send(DESCRIPTOR, CALL_HasParam, _in, _out);
+ }
+
+ static final int CALL_HasParam = 0x10a;
+ }
+ }
+
private static final int CALL_Add3 = 1;
private static final int CALL_Seven = 2;
private static final String DESCRIPTOR = "interfaces";