Fixed KT-5433 J2K: incorrect conversion of method call with vararg
#KT-5433 Fixed
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
//file
|
||||
import java.lang.reflect.Constructor;
|
||||
|
||||
class X {
|
||||
static <T> void foo(Constructor<T> constructor, Object[] args1, Object[] args2) throws Exception {
|
||||
constructor.newInstance(args1);
|
||||
constructor.newInstance(args1, args2);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import java.lang.reflect.Constructor
|
||||
|
||||
class X {
|
||||
class object {
|
||||
throws(javaClass<Exception>())
|
||||
fun <T> foo(constructor: Constructor<T>, args1: Array<Any>, args2: Array<Any>) {
|
||||
constructor.newInstance(*args1)
|
||||
constructor.newInstance(args1, args2)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
//file
|
||||
import javaApi.WithVarargConstructor;
|
||||
|
||||
import java.lang.String;
|
||||
|
||||
class X {
|
||||
void foo() {
|
||||
WithVarargConstructor o1 = new WithVarargConstructor(1, new Object[]{"a"});
|
||||
WithVarargConstructor o2 = new WithVarargConstructor(2, new Object[]{"a"}, new Object[]{"b"});
|
||||
WithVarargConstructor o3 = new WithVarargConstructor(2, "a");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import javaApi.WithVarargConstructor
|
||||
|
||||
class X {
|
||||
fun foo() {
|
||||
val o1 = WithVarargConstructor(1, *array<Any>("a"))
|
||||
val o2 = WithVarargConstructor(2, array<Any>("a"), array<Any>("b"))
|
||||
val o3 = WithVarargConstructor(2, "a")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user