Gjs doesn't execute Vala constructors
When constructing a new instance of a class Gjs doesn't correctly call constructors for libraries written in Vala. I've included a simple example below.
namespace GjsConstructorTest {
public class TestClass : GLib.Object
{
private int field;
public TestClass () {
this.field = 5;
}
public int getField () {
return this.field;
}
}
}
This Gjs code should print 5 but it instead prints 0 indicating the constructor was never called.
const TestClass = imports.gi.GjsConstructorTest.TestClass
let test = new TestClass()
print(test.getField())