Skip to content

Commit cba5782

Browse files
committed
accounts, build, mobile: remove Android and iOS support (ethereum#26599)
1 parent 77b0c0b commit cba5782

26 files changed

+10
-2982
lines changed

.github/CODEOWNERS

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,4 @@ core/ @karalabe @holiman
77
eth/ @karalabe
88
les/ @zsfelfoldi
99
light/ @zsfelfoldi
10-
mobile/ @karalabe
1110
p2p/ @fjl @zsfelfoldi

accounts/abi/bind/bind.go

Lines changed: 8 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ type Lang int
3737

3838
const (
3939
LangGo Lang = iota
40-
LangJava
41-
LangObjC
4240
)
4341

4442
// Bind generates a Go wrapper around a contract ABI. This wrapper isn't meant
@@ -160,15 +158,15 @@ func Bind(types []string, abis []string, bytecodes []string, pkg string, lang La
160158
// bindType is a set of type binders that convert Solidity types to some supported
161159
// programming language types.
162160
var bindType = map[Lang]func(kind abi.Type) string{
163-
LangGo: bindTypeGo,
164-
LangJava: bindTypeJava,
161+
LangGo: bindTypeGo,
165162
}
166163

167164
// Helper function for the binding generators.
168165
// It reads the unmatched characters after the inner type-match,
169-
// (since the inner type is a prefix of the total type declaration),
170-
// looks for valid arrays (possibly a dynamic one) wrapping the inner type,
171-
// and returns the sizes of these arrays.
166+
//
167+
// (since the inner type is a prefix of the total type declaration),
168+
// looks for valid arrays (possibly a dynamic one) wrapping the inner type,
169+
// and returns the sizes of these arrays.
172170
//
173171
// Returned array sizes are in the same order as solidity signatures; inner array size first.
174172
// Array sizes may also be "", indicating a dynamic array.
@@ -244,15 +242,6 @@ func arrayBindingJava(inner string, arraySizes []string) string {
244242
return inner + strings.Repeat("[]", len(arraySizes))
245243
}
246244

247-
// bindTypeJava converts a Solidity type to a Java one. Since there is no clear mapping
248-
// from all Solidity types to Java ones (e.g. uint17), those that cannot be exactly
249-
// mapped will use an upscaled type (e.g. BigDecimal).
250-
func bindTypeJava(kind abi.Type) string {
251-
stringKind := kind.String()
252-
innerLen, innerMapping := bindUnnestedTypeJava(stringKind)
253-
return arrayBindingJava(wrapArray(stringKind, innerLen, innerMapping))
254-
}
255-
256245
// The inner function of bindTypeJava, this finds the inner type of stringKind.
257246
// (Or just the type itself if it is not an array or slice)
258247
// The length of the matched part is returned, with the the translated type.
@@ -311,8 +300,7 @@ func bindUnnestedTypeJava(stringKind string) (int, string) {
311300
// bindTopicType is a set of type binders that convert Solidity types to some
312301
// supported programming language topic types.
313302
var bindTopicType = map[Lang]func(kind abi.Type) string{
314-
LangGo: bindTopicTypeGo,
315-
LangJava: bindTopicTypeJava,
303+
LangGo: bindTopicTypeGo,
316304
}
317305

318306
// bindTypeGo converts a Solidity topic type to a Go one. It is almost the same
@@ -325,64 +313,16 @@ func bindTopicTypeGo(kind abi.Type) string {
325313
return bound
326314
}
327315

328-
// bindTypeGo converts a Solidity topic type to a Java one. It is almost the same
329-
// funcionality as for simple types, but dynamic types get converted to hashes.
330-
func bindTopicTypeJava(kind abi.Type) string {
331-
bound := bindTypeJava(kind)
332-
if bound == "String" || bound == "Bytes" {
333-
bound = "Hash"
334-
}
335-
return bound
336-
}
337-
338316
// namedType is a set of functions that transform language specific types to
339317
// named versions that my be used inside method names.
340318
var namedType = map[Lang]func(string, abi.Type) string{
341-
LangGo: func(string, abi.Type) string { panic("this shouldn't be needed") },
342-
LangJava: namedTypeJava,
343-
}
344-
345-
// namedTypeJava converts some primitive data types to named variants that can
346-
// be used as parts of method names.
347-
func namedTypeJava(javaKind string, solKind abi.Type) string {
348-
switch javaKind {
349-
case "byte[]":
350-
return "Binary"
351-
case "byte[][]":
352-
return "Binaries"
353-
case "string":
354-
return "String"
355-
case "string[]":
356-
return "Strings"
357-
case "boolean":
358-
return "Bool"
359-
case "boolean[]":
360-
return "Bools"
361-
case "BigInt[]":
362-
return "BigInts"
363-
default:
364-
parts := regexp.MustCompile(`(u)?int([0-9]*)(\[[0-9]*\])?`).FindStringSubmatch(solKind.String())
365-
if len(parts) != 4 {
366-
return javaKind
367-
}
368-
switch parts[2] {
369-
case "8", "16", "32", "64":
370-
if parts[3] == "" {
371-
return capitalise(fmt.Sprintf("%sint%s", parts[1], parts[2]))
372-
}
373-
return capitalise(fmt.Sprintf("%sint%ss", parts[1], parts[2]))
374-
375-
default:
376-
return javaKind
377-
}
378-
}
319+
LangGo: func(string, abi.Type) string { panic("this shouldn't be needed") },
379320
}
380321

381322
// methodNormalizer is a name transformer that modifies Solidity method names to
382323
// conform to target language naming concentions.
383324
var methodNormalizer = map[Lang]func(string) string{
384-
LangGo: capitalise,
385-
LangJava: decapitalise,
325+
LangGo: capitalise,
386326
}
387327

388328
// capitalise makes a camel-case string which starts with an upper case character.

accounts/abi/bind/template.go

Lines changed: 1 addition & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ type tmplEvent struct {
5252
// tmplSource is language to template mapping containing all the supported
5353
// programming languages the package can generate to.
5454
var tmplSource = map[Lang]string{
55-
LangGo: tmplSourceGo,
56-
LangJava: tmplSourceJava,
55+
LangGo: tmplSourceGo,
5756
}
5857

5958
// tmplSourceGo is the Go source template use to generate the contract binding
@@ -418,105 +417,3 @@ package {{.Package}}
418417
{{end}}
419418
{{end}}
420419
`
421-
422-
// tmplSourceJava is the Java source template use to generate the contract binding
423-
// based on.
424-
const tmplSourceJava = `
425-
// This file is an automatically generated Java binding. Do not modify as any
426-
// change will likely be lost upon the next re-generation!
427-
428-
package {{.Package}};
429-
430-
import org.ethereum.geth.*;
431-
import org.ethereum.geth.internal.*;
432-
433-
{{range $contract := .Contracts}}
434-
public class {{.Type}} {
435-
// ABI is the input ABI used to generate the binding from.
436-
public final static String ABI = "{{.InputABI}}";
437-
438-
{{if .InputBin}}
439-
// BYTECODE is the compiled bytecode used for deploying new contracts.
440-
public final static byte[] BYTECODE = "{{.InputBin}}".getBytes();
441-
442-
// deploy deploys a new Ethereum contract, binding an instance of {{.Type}} to it.
443-
public static {{.Type}} deploy(TransactOpts auth, EthereumClient client{{range .Constructor.Inputs}}, {{bindtype .Type}} {{.Name}}{{end}}) throws Exception {
444-
Interfaces args = Geth.newInterfaces({{(len .Constructor.Inputs)}});
445-
{{range $index, $element := .Constructor.Inputs}}
446-
args.set({{$index}}, Geth.newInterface()); args.get({{$index}}).set{{namedtype (bindtype .Type) .Type}}({{.Name}});
447-
{{end}}
448-
return new {{.Type}}(Geth.deployContract(auth, ABI, BYTECODE, client, args));
449-
}
450-
451-
// Internal constructor used by contract deployment.
452-
private {{.Type}}(BoundContract deployment) {
453-
this.Address = deployment.getAddress();
454-
this.Deployer = deployment.getDeployer();
455-
this.Contract = deployment;
456-
}
457-
{{end}}
458-
459-
// Ethereum address where this contract is located at.
460-
public final Address Address;
461-
462-
// Ethereum transaction in which this contract was deployed (if known!).
463-
public final Transaction Deployer;
464-
465-
// Contract instance bound to a blockchain address.
466-
private final BoundContract Contract;
467-
468-
// Creates a new instance of {{.Type}}, bound to a specific deployed contract.
469-
public {{.Type}}(Address address, EthereumClient client) throws Exception {
470-
this(Geth.bindContract(address, ABI, client));
471-
}
472-
473-
{{range .Calls}}
474-
{{if gt (len .Normalized.Outputs) 1}}
475-
// {{capitalise .Normalized.Name}}Results is the output of a call to {{.Normalized.Name}}.
476-
public class {{capitalise .Normalized.Name}}Results {
477-
{{range $index, $item := .Normalized.Outputs}}public {{bindtype .Type}} {{if ne .Name ""}}{{.Name}}{{else}}Return{{$index}}{{end}};
478-
{{end}}
479-
}
480-
{{end}}
481-
482-
// {{.Normalized.Name}} is a free data retrieval call binding the contract method 0x{{printf "%x" .Original.Id}}.
483-
//
484-
// Solidity: {{.Original.String}}
485-
public {{if gt (len .Normalized.Outputs) 1}}{{capitalise .Normalized.Name}}Results{{else}}{{range .Normalized.Outputs}}{{bindtype .Type}}{{end}}{{end}} {{.Normalized.Name}}(CallOpts opts{{range .Normalized.Inputs}}, {{bindtype .Type}} {{.Name}}{{end}}) throws Exception {
486-
Interfaces args = Geth.newInterfaces({{(len .Normalized.Inputs)}});
487-
{{range $index, $item := .Normalized.Inputs}}args.set({{$index}}, Geth.newInterface()); args.get({{$index}}).set{{namedtype (bindtype .Type) .Type}}({{.Name}});
488-
{{end}}
489-
490-
Interfaces results = Geth.newInterfaces({{(len .Normalized.Outputs)}});
491-
{{range $index, $item := .Normalized.Outputs}}Interface result{{$index}} = Geth.newInterface(); result{{$index}}.setDefault{{namedtype (bindtype .Type) .Type}}(); results.set({{$index}}, result{{$index}});
492-
{{end}}
493-
494-
if (opts == null) {
495-
opts = Geth.newCallOpts();
496-
}
497-
this.Contract.call(opts, results, "{{.Original.Name}}", args);
498-
{{if gt (len .Normalized.Outputs) 1}}
499-
{{capitalise .Normalized.Name}}Results result = new {{capitalise .Normalized.Name}}Results();
500-
{{range $index, $item := .Normalized.Outputs}}result.{{if ne .Name ""}}{{.Name}}{{else}}Return{{$index}}{{end}} = results.get({{$index}}).get{{namedtype (bindtype .Type) .Type}}();
501-
{{end}}
502-
return result;
503-
{{else}}{{range .Normalized.Outputs}}return results.get(0).get{{namedtype (bindtype .Type) .Type}}();{{end}}
504-
{{end}}
505-
}
506-
{{end}}
507-
508-
{{range .Transacts}}
509-
// {{.Normalized.Name}} is a paid mutator transaction binding the contract method 0x{{printf "%x" .Original.Id}}.
510-
//
511-
// Solidity: {{.Original.String}}
512-
public Transaction {{.Normalized.Name}}(TransactOpts opts{{range .Normalized.Inputs}}, {{bindtype .Type}} {{.Name}}{{end}}) throws Exception {
513-
Interfaces args = Geth.newInterfaces({{(len .Normalized.Inputs)}});
514-
{{range $index, $item := .Normalized.Inputs}}args.set({{$index}}, Geth.newInterface()); args.get({{$index}}).set{{namedtype (bindtype .Type) .Type}}({{.Name}});
515-
{{end}}
516-
517-
return this.Contract.transact(opts, "{{.Original.Name}}" , args);
518-
}
519-
{{end}}
520-
}
521-
{{end}}
522-
`

cmd/abigen/main.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ var (
3838

3939
pkgFlag = flag.String("pkg", "", "Package name to generate the binding into")
4040
outFlag = flag.String("out", "", "Output file for the generated binding (default = stdout)")
41-
langFlag = flag.String("lang", "go", "Destination language for the bindings (go, java, objc)")
41+
langFlag = flag.String("lang", "go", "Destination language for the bindings (go)")
4242
)
4343

4444
func main() {
@@ -60,10 +60,6 @@ func main() {
6060
switch *langFlag {
6161
case "go":
6262
lang = bind.LangGo
63-
case "java":
64-
lang = bind.LangJava
65-
case "objc":
66-
lang = bind.LangObjC
6763
default:
6864
fmt.Printf("Unsupported destination language \"%s\" (--lang)\n", *langFlag)
6965
os.Exit(-1)

0 commit comments

Comments
 (0)