Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

accounts/abi: fix case of generated java functions #18372

Merged
merged 2 commits into from
Jan 2, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions accounts/abi/bind/bind.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}

Expand All @@ -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
Expand Down