neow3j: Compile error: String concatentation
Compiling the class below throws an exception
public class HelloWorld {
public static String hello(String arg1, String arg2) {
return arg1 + arg2;
}
}
Exception in thread "main" java.lang.IndexOutOfBoundsException
at org.objectweb.asm.tree.InsnList.get(InsnList.java:94)
at io.neow3j.compiler.NeoMethod.convert(NeoMethod.java:486)
at io.neow3j.compiler.converters.MethodsConverter.handleUncachedMethodCall(MethodsConverter.java:193)
at io.neow3j.compiler.converters.MethodsConverter.handleMethodCall(MethodsConverter.java:167)
at io.neow3j.compiler.converters.MethodsConverter.handleInvoke(MethodsConverter.java:148)
at io.neow3j.compiler.converters.MethodsConverter.convert(MethodsConverter.java:81)
at io.neow3j.compiler.Compiler.handleInsn(Compiler.java:404)
at io.neow3j.compiler.converters.ObjectsConverter.handleStringConcatenation(ObjectsConverter.java:301)
at io.neow3j.compiler.converters.ObjectsConverter.handleNew(ObjectsConverter.java:167)
at io.neow3j.compiler.converters.ObjectsConverter.convert(ObjectsConverter.java:83)
at io.neow3j.compiler.Compiler.handleInsn(Compiler.java:404)
at io.neow3j.compiler.NeoMethod.convert(NeoMethod.java:488)
at io.neow3j.compiler.converters.MethodsConverter.handleUncachedMethodCall(MethodsConverter.java:193)
at io.neow3j.compiler.converters.MethodsConverter.handleMethodCall(MethodsConverter.java:167)
at io.neow3j.compiler.converters.MethodsConverter.handleInvoke(MethodsConverter.java:148)
at io.neow3j.compiler.converters.MethodsConverter.convert(MethodsConverter.java:81)
at io.neow3j.compiler.Compiler.handleInsn(Compiler.java:404)
at io.neow3j.compiler.NeoMethod.convert(NeoMethod.java:488)
at io.neow3j.compiler.converters.MethodsConverter.handleUncachedMethodCall(MethodsConverter.java:193)
at io.neow3j.compiler.converters.MethodsConverter.handleMethodCall(MethodsConverter.java:167)
at io.neow3j.compiler.converters.MethodsConverter.handleInvoke(MethodsConverter.java:148)
at io.neow3j.compiler.converters.MethodsConverter.convert(MethodsConverter.java:81)
at io.neow3j.compiler.Compiler.handleInsn(Compiler.java:404)
at io.neow3j.compiler.converters.ObjectsConverter.handleStringConcatenation(ObjectsConverter.java:301)
at io.neow3j.compiler.converters.ObjectsConverter.handleNew(ObjectsConverter.java:167)
at io.neow3j.compiler.converters.ObjectsConverter.convert(ObjectsConverter.java:83)
at io.neow3j.compiler.Compiler.handleInsn(Compiler.java:404)
at io.neow3j.compiler.NeoMethod.convert(NeoMethod.java:488)
at io.neow3j.compiler.Compiler.compile(Compiler.java:271)
at io.neow3j.compiler.Compiler.compile(Compiler.java:240)
at io.neow3j.examples.contractdevelopment.CompileAndDeploy.main(CompileAndDeploy.java:26)
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 19 (12 by maintainers)
That’s good to know, so from now on ill compile my contracts using the gradle task.
openjdk version “11.0.11” 2021-04-20 OpenJDK Runtime Environment (build 11.0.11+9-Ubuntu-0ubuntu2.20.04) OpenJDK 64-Bit Server VM (build 11.0.11+9-Ubuntu-0ubuntu2.20.04, mixed mode, sharing)
Hey @gsmachado that’s great news! Unfortunately I am still running into this issue. I will add the compiled class file to this post @csmuller . I am working with java 11.
StringConcatContract3.class.zip
I also did some more testing, the compile error only happens when I concatenate 2 string variables like in bongoCat2() and bongoCat3().