cincheo / jsweet

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

Local class doesn't capture variables #671

Open rendaw opened 3 years ago

rendaw commented 3 years ago

The following doesn't compile:

public class ThingA {
    public ThingA(int a) {
        class Inner {
            public int red() {
                return a;
            }
        }
    }
}
[ERROR] * /.../jsweettest/moda/ThingA.java(9,24)cannot find name 'a'

Inner is turned into a non-inner class but "a" isn't forwarded to it.

Using the maven plugin version 2.4.0-SNAPSHOT.

lgrignon commented 3 years ago

Thanks @rendaw for reporting all those specific Java features not yet supported in JSweet. There are indeed still some side cases to be handled.

I am not sure when we will find time to handle the ones you noticed but we definitely recommend you to use the last 3.1.0-SNAPSHOT, and please note that we are always open to contributions.

Thanks again, let's keep in touch.