First of all this is not some normal action I would want to do, however this fringe case involving alot of legacy code I cannot touch, and unit tests that need to be written for newer stuff.
Anyway I have a class and I can get access to all fields and methods through reflection, except private/protected static ones. So is there any way to get access to these private static method through reflection?
Method method = Foo.class.getDeclaredMethod("methodName");
method.setAccessible(true);
Object result = method.invoke(null);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With