I can refer String
in kotlin as String::class.java
but how to refer String...
?
I need to use it to test a private method
private void someMethod(int a, int b, String... c) {
. . .
}
val method: Method = SomeActivity::class.java.getDeclaredMethod(
"someMethod",
Int::class.java,
Int::class.java,
{{need help here}}
)
method.isAccessible = true
method.invoke(activity, 0, 0, "")
CodePudding user response:
I can refer to it easily using Array<String>::class.java
val method: Method = SomeActivity::class.java.getDeclaredMethod(
"someMethod",
Int::class.java,
Int::class.java,
Array<String>::class.java
)
method.isAccessible = true
method.invoke(activity, 0, 0, arrayOf(""))