diff options
author | Guillaume Ballet <gballet@gmail.com> | 2019-01-02 17:22:10 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-02 17:22:10 +0800 |
commit | 9bfd0b60cc5af3d6b8fdd9fae33ec1c0a4eb31b8 (patch) | |
tree | 446e7a675b191eee52a1c8fc426653fb333fb1a3 /accounts/abi/bind | |
parent | a4af734328d50b9ea89405c7e5050065a8087946 (diff) | |
download | dexon-9bfd0b60cc5af3d6b8fdd9fae33ec1c0a4eb31b8.tar.gz dexon-9bfd0b60cc5af3d6b8fdd9fae33ec1c0a4eb31b8.tar.zst dexon-9bfd0b60cc5af3d6b8fdd9fae33ec1c0a4eb31b8.zip |
accounts/abi: fix case of generated java functions (#18372)
Diffstat (limited to 'accounts/abi/bind')
-rw-r--r-- | accounts/abi/bind/bind.go | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/accounts/abi/bind/bind.go b/accounts/abi/bind/bind.go index 21e16060c..5ee30d024 100644 --- a/accounts/abi/bind/bind.go +++ b/accounts/abi/bind/bind.go @@ -381,7 +381,7 @@ func namedTypeJava(javaKind string, solKind abi.Type) string { // methodNormalizer is a name transformer that modifies Solidity method names to // conform to target language naming concentions. var methodNormalizer = map[Lang]func(string) string{ - LangGo: capitalise, + LangGo: abi.ToCamelCase, LangJava: decapitalise, } @@ -392,10 +392,12 @@ func capitalise(input string) string { // decapitalise makes a camel-case string which starts with a lower case character. func decapitalise(input string) string { - // NOTE: This is the current behavior, it doesn't match the comment - // above and needs to be investigated. - return abi.ToCamelCase(input) + if len(input) == 0 { + return input + } + goForm := abi.ToCamelCase(input) + return strings.ToLower(goForm[:1]) + goForm[1:] } // structured checks whether a list of ABI data types has enough information to |