cincheo / jsweet

A Java to JavaScript transpiler.
http://www.jsweet.org
Other
1.45k stars 159 forks source link

Invalid code generated for anonymous classes #682

Open andreasmuelder opened 3 years ago

andreasmuelder commented 3 years ago

Argument of type 'Example$0' is not assignable to parameter of type '() => void'. Type 'Example$0' provides no match for the signature '(): void'.ts(2345)

inEventQueue.add(new Runnable() {
    @Override
    public void run() {
       // do stuff
    }
});

results in

    public raiseTimeEvent(eventID: number) {
        /* add */(this.inEventQueue.push(new Example.Example$0(this, eventID))>0);
        this.runCycle();
    }
lgrignon commented 3 years ago

That's odd. Thanks for reporting @andreasmuelder Could you please include the related Example.Example$0 class definition?

Also, please try again with latest JSweet 3.1.0-SNAPSHOT (about to be released soon)