I'm getting the following error when I try to upgrade java 8 to 11
java.lang.IllegalAccessError: class jdk.internal.reflect.ConstructorAccessorImpl loaded by org.powermock.core.classloader.MockClassLoade
If I use the following annotation in my test case, it will pass. @PowerMockIgnore("jdk.internal.reflect.*")
But, the above error will be thrown as a warning.
How can I use the following JVM option to resolve this? Can I only use JVM option without annotation?
--add-opens java.base/jdk.internal.reflect=ALL-UNNAMED