usethesource / flybytes

Flybytes is an intermediate language between JVM bytecode and software languages (DSLs, PLs), for compilation and decompilation.
BSD 2-Clause "Simplified" License
16 stars 6 forks source link

roundtrip dissassemble/compile for |lib://rascal/org/rascalmpl/util/VersionInfo.class| fails with exception #14

Closed jurgenvinju closed 1 year ago

jurgenvinju commented 4 years ago
rascal>compileClass(cl, |home:///test.class|)
io.usethesource.vallang.exceptions.UndeclaredFieldException: tuple[list[Type] formals] does not have a field with label name declared for it
        at io.usethesource.vallang.type.TupleTypeWithFieldNames.getFieldIndex(TupleTypeWithFieldNames.java:66)
        at io.usethesource.vallang.type.ConstructorType.getFieldIndex(ConstructorType.java:248)
        at io.usethesource.vallang.impl.persistent.Constructor$AbstractConstructor.get(Constructor.java:172)

the disassembled class:

class(object("org.rascalmpl.util.VersionInfo"),methods=[procedure(constructorDesc([]),[],[LABEL("L770815263"),LINENUMBER(3,"L770815263"),ALOAD(0),INVOKESPECIAL(object("java.lang.Object"),constructorDesc([]),false),RETURN(),LABEL("L1611169594"),LOCALVARIABLE("this",object("org.rascalmpl.util.VersionInfo"),"L770815263","L1611169594",0)])],fields=[field(string(),"RASCAL_VERSION",init=const(string(),"0.0.0"),modifiers={final(),static(),public()}),field(string(),"RASCAL_RUNTIME_VERSION",init=const(string(),"0.0.0"),modifiers={final(),static(),public()}),field(string(),"RASCAL_COMPILER_VERSION",init=const(string(),"0.0.0"),modifiers={final(),static(),public()})],interfaces=[],super=object("java.lang.Object"),modifiers={synchronized(),public()})

I suspect the INVOKESPECIAL is not implemented correctly for constructors in the compiler.