Fix code by using getDeclaredConstructor instead