byte-buddy icon indicating copy to clipboard operation
byte-buddy copied to clipboard

Java 17 reflection changes

Open rupinder10 opened this issue 1 year ago • 0 comments

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 ?

rupinder10 avatar Jul 28 '24 00:07 rupinder10