Paste this Java code into the live sandbox. You can see the code for the zero-argument constructor is wrong, with the default initialization for number occurring last instead of first.
package org.jsweet;
import static def.dom.Globals.*;
public class HelloWorld {
public static void main(String[] args) {
Overloaded obj = new Overloaded(44);
alert( "This should be 44: " + obj.getNumber() );
obj = new Overloaded();
alert( "This should be 23: " + obj.getNumber() );
}
}
public class Overloaded {
private int number = 0;
public Overloaded( int number ) {
super();
this.number = number;
}
public Overloaded() {
this(23);
}
public int getNumber() {
return this.number;
}
}
This is a critical problem. I believe it is causing a regression in j4ts java.util.TreeMap, which has overloaded constructors, when I build that with JSweet 3.1.0.
This is a regression, as it was working in 2.3.7.
Paste this Java code into the live sandbox. You can see the code for the zero-argument constructor is wrong, with the default initialization for number occurring last instead of first.