Skip to content

Variadic constructors do not always compile correctly. #91

Description

@jaredlll08
@ZenCodeType.Name("example.MyThing")
publicclassMyThing {
@ZenCodeType.ConstructorpublicMyThing(String... arr) {
}
}
importexample.MyThing;
new MyThing();
new MyThing(["hello", "world"]);

produces:

ERROR: [Ljava.lang.String;
publicclasstest {
publicstaticvoidrun(String[] var0) {
newMyThing(newString[]{newString[0]});
newMyThing(newString[]{newString[]{"hello", "world"}});
}
}
// class version 52.0 (52)// access flags 0x1publicclassscript/test {
// compiled from: test.zs// access flags 0x9publicstaticrun([Ljava/lang/String;)VL0LINENUMBER2L0NEWorg/openzen/zenscript/scriptingexample/MyThingDUPLDC1ANEWARRAYjava/lang/StringDUPLDC0LDC0ANEWARRAYjava/lang/StringAASTOREINVOKESPECIALorg/openzen/zenscript/scriptingexample/MyThing.<init> ([Ljava/lang/String;)VPOPL1LINENUMBER4L1NEWorg/openzen/zenscript/scriptingexample/MyThingDUPLDC1ANEWARRAYjava/lang/StringDUPLDC0LDC2ANEWARRAYjava/lang/StringDUPLDC0LDC "hello" AASTORE DUP LDC 1 LDC "world"
AASTORE
AASTORE
INVOKESPECIAL org/openzen/zenscript/scriptingexample/MyThing.<init> ([Ljava/lang/String;)V
POP
RETURN
MAXSTACK = 9
MAXLOCALS = 1
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingbytecodeAll issues that relate to the generation of Java Bytecode

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions