I feel like this has been asked before and I'm not finding the right search terms. (reflection and static are too narrow.) Can someone help an internet detective?
I'm trying to use reflection to get the Class object from a string package/class name. Using Class.forName works fine for most of my classes. The few that fail have a static field that calls a method that reads from a property file. Which fails because in my test environment that property isn't there.
I can't change the code that makes the static call. (And I need reflection for some analysis on it.) Is it possible to do this? How?
Try commenting out these last two lines one by one. You can even use reflection, as long as you don't try to invoke the methods / get the field values / set the field values. But listing fields and methods, not a problem.