Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support running DG Toolkit 4.x with default --illegal-access=deny #364

Closed
nmandrescu opened this issue May 11, 2021 · 1 comment
Closed
Assignees
Milestone

Comments

@nmandrescu
Copy link
Contributor

nmandrescu commented May 11, 2021

JDK16 brings JEP 396 that defaults to --illegal-access=deny. Current workaround is to use --illegal-access=permit (or warn) to bypass illegal reflective-access restriction.

JEP 403 is planned for JDK17 (Sept 2021), that will remove --illegal-access flag altogether and act always with deny rule.

Illegal reflective access in DGToolkit 4.x are reported for (some samples):

  • wicket-core/9.3.0
  • jackson-databind/2.12.3
  • cglib/3.3.0

Example:

WARNING: Illegal reflective access by org.apache.wicket.core.util.lang.PropertyResolver$DefaultPropertyLocator (file:~/.m2/repository/org/apache/wicket/wicket-core/9.3.0/wicket-core-9.3.0.jar) to field java.lang.Enum.name

Note: also cleanup readme about illegal-access once no longer needed.

@nmandrescu nmandrescu added this to the 4.x milestone May 11, 2021
nmandrescu added a commit that referenced this issue Jun 1, 2021
@nmandrescu nmandrescu self-assigned this Jun 1, 2021
@nmandrescu
Copy link
Contributor Author

The solution is to grand illegal reflective access with --add-opens for specific modules used by above libraries:

  • wicket and jackson libs by nature heavily rely on reflection. Both try to use a setter/getter method before accessing a field directly.
    • DG Toolkit modules should carefully define getters/setters for reflective usage.
    • Some external modules can still miss getter/setters and they need to be explicitly opened. Nevertheless we should report to wicket/jackson such use cases, since they can (and did) find ways to bypass some of them.
  • cglib however needs to transition to a standard replacement Java 16 and 17 compatibility cglib/cglib#191

A few modules are now opened to ALL-UNNAMED. It would be best to open them only to wicket/jackson modules. We can either find the right module path config (couldn't figure the setup that works) or use Java Module system #379 to open from there. Until then the entries are stored in the argfile.txt that has to be provided as JVM option java @argfile.txt ...

Ofc DG Toolkit based projects will grow and may encounter new use cases to open other modules.

@nmandrescu nmandrescu added this to To do in DG Toolkit 4.x via automation Jun 1, 2021
@nmandrescu nmandrescu moved this from To do to In progress in DG Toolkit 4.x Jun 1, 2021
@nmandrescu nmandrescu moved this from In progress to Done in DG Toolkit 4.x Jun 1, 2021
@nmandrescu nmandrescu moved this from Done to Closed in DG Toolkit 4.x Jun 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

1 participant