Closed jimfb closed 8 years ago
Invoking the constructor with the integer 42 should result in it printing 42, but actually prints -0.
// Test.java import java.lang.reflect.Constructor; public class Test { public Test(int a) { System.out.println("Number: " + a); } public static void main(String[] args) { try { Constructor<?> constructor = Test.class.getConstructors()[0]; constructor.newInstance(new Object[] { 42 }); new Test(43); } catch (Exception e) { e.printStackTrace(); } } } $ javac Test.java $ doppio Test Number: -0 Number: 43
Good catch. Looks like an unboxing bug.
Invoking the constructor with the integer 42 should result in it printing 42, but actually prints -0.