@@ -37,8 +37,6 @@ type Lang int
3737
3838const (
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.
162160var 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.
313302var 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.
340318var 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.
383324var 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.
0 commit comments