[code="java"]
package test;
import java.lang.reflect.Method;
public class OtherTest {
public void doTest(OtherTest[] tests){
}
public static void main(String[] args) throws Exception{
Class clazz = Class.forName("test.OtherTest");
Method method = clazz.getDeclaredMethod("doTest", OtherTest[].class);
}
}
[/code]
请问有没办法通过clazz替换掉getDeclaredMethod的第二个入参,上面是写死成OtherTest[].class,但是实际情况下,需要写成通用方式,谢谢。
注:目前采用将入参OtherTest[]修改为一个中间类的方式规避,请不要告知这种解决办法。