web3j
web3j copied to clipboard
The type generates a string that requires more than 65535 bytes to encode in Utf8 format in the constant pool
Error in java class generated: The type generates a string that requires more than 65535 bytes to encode in Utf8 format in the constant pool
After generating my java class from my solidity contract with web3j, my java class has the error "The type generates a string that requires more than 65535 bytes to encode in Utf8 format in the constant pool"
Steps To Reproduce
Write a long solidity contract and generate the java code using your contract.
Possible solution: make the binary a non final attribute.
I'm hitting the same problem.
Two solutions would be to either split it between n strings and concatenate in static initializer (quick and dirty solution) or create separate .bin file which gets loaded on demand if needed (or possibly in static init as well) - but this breaks the nice feature of having everything for a contract in a single file.
@asuarezgrupobme This is not really a web3j issue but a java limitation. @abies I think the first solution would be a more viable one. I don't think it's a good idea to break things into multiple files.
I'm sitting on changeset for that one already (among other things), but I'm waiting for my company to sort out legal stuff regarding contributions. Still, given it is a simple stuff, it might be faster for your to implement it rather than wait for me.
It is just new StringBuffer(333333).append("FIRSTPART").append("SECONDPART")....toString(), with parts being split into (2^16-2) chunks (where 333333 is proper size of course).
Any updates on this issue?