未验证 提交 9bfd0b60 编写于 作者: G Guillaume Ballet 提交者: GitHub

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

上级 a4af7343
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册