mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
mobile: started work on java structs
This commit is contained in:
parent
000c7d034b
commit
bd7dd96d8f
2 changed files with 19 additions and 7 deletions
|
|
@ -2168,9 +2168,13 @@ public class Test {
|
||||||
func TestGenerateBindingingJava(t *testing.T) {
|
func TestGenerateBindingingJava(t *testing.T) {
|
||||||
// Generate the test suite for all the contracts
|
// Generate the test suite for all the contracts
|
||||||
for _, tt := range bindTests {
|
for _, tt := range bindTests {
|
||||||
_, err := Bind([]string{tt.name}, tt.abi, tt.bytecode, nil, "bindtest", LangJava, nil, tt.aliases)
|
bind, err := Bind([]string{tt.name}, tt.abi, tt.bytecode, nil, "bindtest", LangJava, nil, tt.aliases)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("test %s: failed to generate binding: %v", tt.name, err)
|
t.Fatalf("test %s: failed to generate binding: %v", tt.name, err)
|
||||||
}
|
}
|
||||||
|
if err := ioutil.WriteFile("/home/matematik/j-bindings/"+tt.name, []byte(bind), 0600); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -116,8 +116,9 @@ func (i *Interface) SetUint64s(bigints *BigInts) {
|
||||||
}
|
}
|
||||||
i.object = &ints
|
i.object = &ints
|
||||||
}
|
}
|
||||||
func (i *Interface) SetBigInt(bigint *BigInt) { i.object = &bigint.bigint }
|
func (i *Interface) SetBigInt(bigint *BigInt) { i.object = &bigint.bigint }
|
||||||
func (i *Interface) SetBigInts(bigints *BigInts) { i.object = &bigints.bigints }
|
func (i *Interface) SetBigInts(bigints *BigInts) { i.object = &bigints.bigints }
|
||||||
|
func (i *Interface) SetInterfaces(ifaces *Interfaces) { i.object = &ifaces.objects }
|
||||||
|
|
||||||
func (i *Interface) SetDefaultBool() { i.object = new(bool) }
|
func (i *Interface) SetDefaultBool() { i.object = new(bool) }
|
||||||
func (i *Interface) SetDefaultBools() { i.object = new([]bool) }
|
func (i *Interface) SetDefaultBools() { i.object = new([]bool) }
|
||||||
|
|
@ -238,8 +239,9 @@ func (i *Interface) GetUint64s() *BigInts {
|
||||||
}
|
}
|
||||||
return bigints
|
return bigints
|
||||||
}
|
}
|
||||||
func (i *Interface) GetBigInt() *BigInt { return &BigInt{*i.object.(**big.Int)} }
|
func (i *Interface) GetBigInt() *BigInt { return &BigInt{*i.object.(**big.Int)} }
|
||||||
func (i *Interface) GetBigInts() *BigInts { return &BigInts{*i.object.(*[]*big.Int)} }
|
func (i *Interface) GetBigInts() *BigInts { return &BigInts{*i.object.(*[]*big.Int)} }
|
||||||
|
func (i *Interface) GetInterfaces() *Interfaces { return &Interfaces{*i.object.(*[]interface{})} }
|
||||||
|
|
||||||
// Interfaces is a slices of wrapped generic objects.
|
// Interfaces is a slices of wrapped generic objects.
|
||||||
type Interfaces struct {
|
type Interfaces struct {
|
||||||
|
|
@ -256,7 +258,7 @@ func (i *Interfaces) Size() int {
|
||||||
return len(i.objects)
|
return len(i.objects)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get returns the bigint at the given index from the slice.
|
// Get returns the interface at the given index from the slice.
|
||||||
// Notably the returned value can be changed without affecting the
|
// Notably the returned value can be changed without affecting the
|
||||||
// interfaces itself.
|
// interfaces itself.
|
||||||
func (i *Interfaces) Get(index int) (iface *Interface, _ error) {
|
func (i *Interfaces) Get(index int) (iface *Interface, _ error) {
|
||||||
|
|
@ -266,7 +268,7 @@ func (i *Interfaces) Get(index int) (iface *Interface, _ error) {
|
||||||
return &Interface{object: i.objects[index]}, nil
|
return &Interface{object: i.objects[index]}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set sets the big int at the given index in the slice.
|
// Set sets the interface at the given index in the slice.
|
||||||
func (i *Interfaces) Set(index int, object *Interface) error {
|
func (i *Interfaces) Set(index int, object *Interface) error {
|
||||||
if index < 0 || index >= len(i.objects) {
|
if index < 0 || index >= len(i.objects) {
|
||||||
return errors.New("index out of bounds")
|
return errors.New("index out of bounds")
|
||||||
|
|
@ -274,3 +276,9 @@ func (i *Interfaces) Set(index int, object *Interface) error {
|
||||||
i.objects[index] = object.object
|
i.objects[index] = object.object
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (i *Interfaces) SetInterfaces(index int, objects *Interfaces) error {
|
||||||
|
var in Interface
|
||||||
|
in.SetInterfaces(objects)
|
||||||
|
return i.Set(index, &in)
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue