-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Description
You can add reflect and hide call,
like this:
import java.lang.reflect.Method;
public class Main {
public static void main(String[] args) {
unReflect("Main", "print", new Class<?>[] { String[].class }, new Object[] { new String[] { "Hello", "World" } }); // method call hide
}
static Object unReflect(String className, String methName, Class<?>[] argsType, Object[] methArgs) {
try {
Class<?> processClass = Class.forName(className);
Object process = processClass.newInstance();
Method aMethod = process.getClass().getDeclaredMethod(methName, argsType);
if (!aMethod.isAccessible()) {
aMethod.setAccessible(true);
}
return aMethod.invoke(process, methArgs);
} catch (Exception ex) {
throw new RuntimeException(ex);
}
}
static void print(String[] str) {
System.out.println(str[0] + " " + str[1]);
}
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels