cincheo / jsweet

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

ArrayList.remove(int) does not return good objects #503

Closed lgrignon closed 5 years ago

lgrignon commented 5 years ago

This code should return the removed object, returns an array instead

void setup() {
    ArrayList<Instruction> nums = new ArrayList<Instruction>();
    nums.add(new Instruction(1,2));

    Instruction x = nums.remove(0);
    println(x);   // "Object"
    println(x.from);  // undefined
    println(x.to);
}

class Instruction {
  int from, to;

  Instruction(int f, int t) {
    from = f;
    to = t;
  }
}