0

I'd like to disable reflective security both during the compilation, and running of my application. This means that essentially java.lang.IllegalAccessError will never be thrown. It also means that all reflective accesses to all types and all fields are allowed, and none are denied. Here, we can assume the entire project is compiled from source.

How does one accomplish this?

For this question, we can assume that we're using java 19

tuskiomi
  • 190
  • 1
  • 15
  • 1
    you would need to add `--add-opens` with the correct module and package at runtime... – dan1st Mar 07 '23 at 20:30
  • woah, that's a neat flag. I'm reading the docs now.. – tuskiomi Mar 07 '23 at 20:33
  • 2
    Alternatively, you can change the `module-info.java` of the module to access and open the relevant packages. This approach should be preferred if possible. – dan1st Mar 07 '23 at 20:33
  • And if your application and 3rd-party components depend on accessing the internals of the JDK itself ... you should probably change that. 'Cos it will get harder and harder with newer Java versions. – Stephen C Mar 08 '23 at 00:33

0 Answers0