Skip to content

fix: handle struct and enum prefixes in ABI internalType for code generation#2278

Open
Dev10-sys wants to merge 2 commits intoLFDT-web3j:mainfrom
Dev10-sys:fix/codegen-struct-parsing-1978
Open

fix: handle struct and enum prefixes in ABI internalType for code generation#2278
Dev10-sys wants to merge 2 commits intoLFDT-web3j:mainfrom
Dev10-sys:fix/codegen-struct-parsing-1978

Conversation

@Dev10-sys
Copy link
Copy Markdown
Contributor

Fixes an issue where code generation fails when ABI contains types prefixed with "struct" or "enum" (for example "struct UserOperation").

Previously, these prefixes were not handled correctly, which led to invalid Java code being generated.

This change cleans the internalType by removing these prefixes so that valid Java class names are produced during code generation.

A test is added to verify the behavior.

Fixes #1978

…eb3j#1978)

- Update AbiDefinition.NamedType to strip 'struct ' and 'enum ' prefixes from internalType
- Fixes issues where JavaPoet generated invalid identifiers during codegen
- Add regression test in SolidityFunctionWrapperTest

Signed-off-by: Dev10-sys <kalpanagola9897@gmail.com>
Signed-off-by: Dev10-sys <dev10.sys@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

java code that generates an entryPoint using the abi reports an error: "part 'struct UserOperation' is keyword"

1 participant