byte-buddy
byte-buddy copied to clipboard
Java 17 reflection changes
I have some code developed with Java 8 that uses reflection to call a private method in URLClassLoader. Unfortunately, this isnt possible in Java 17 so the application stops working in Java 17 because the
setAccessible(true) in java.lang.reflect.Method in no longer works. This requires an --add-opens command line parameter. But I cannot do this for a few different reasons.
I was thinking maybe I can add a new class using ByteBuddy into the java.base module and then let that handle this code. Is this possible ? If yes, how can I add a new class to an existing module ?