question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

JDK17 compatibility

See original GitHub issue

Problem

JEP 403 targeted for JDK 17 (release planned for Sept 2021) will remove --illegal-access flag. That will be equivalent to --illegal-access=deny.

Running with --illegal-access=warn apps using jackson-databind and other jackson modules reported here https://github.com/FasterXML/jackson-databind/issues/2856#issuecomment-700581797 can discover issues like WARNING: Illegal reflective access by com.fasterxml.jackson.databind.util.ClassUtil

Workaround

For illegal reflective access pointing to jackson use –add-open for the package containing the restricted field.

Update Not related to jackson library, since JDK 9 a number of standard replacements are provided for the most commonly used internal elements of the JDK.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:29 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
JJBRTcommented, Sep 20, 2021

Please take a look at my new article that explain how to export all modules to all modules at runtime in Java 16 and later without using any JVM parameter

3reactions
cowtowncodercommented, May 31, 2021

Unfortunately most if not all remaining issues that surface with that rather non-descriptive warning are due to dynamic introspection for various JDK types and depend on actual usage. Jackson core itself does not force access to JDK, but to access fields, getters, setters, constructors, introspection is used. ClassUtil specifically gets called to try to force access when it is deemed necessary based on types user tries to serialize/deserialize; it has no “agenda of its known”.

So unfortunately this is not as easy as (for example) replacing use of sun.misc.Unsafe with alternatives.

So what tends to be necessary are user reports for specific usage that triggers these issues: this helps figure out how to prevent specific problems. I am not confident there is a general simple solution; although more and more general improvements can be developed when finding patterns common to reported problems.

Read more comments on GitHub >

github_iconTop Results From Across the Web

JDK 17 Release Notes, Important Changes, and Information
The Kinds of Compatibility page on the OpenJDK wiki identifies the following three types of potential compatibility issues for Java programs that might...
Read more >
Hibernate: all systems go for Java 17 - In Relation To
Hibernate Validator versions 7.0 6.2 are also compatible with Java 17. Hibernate Reactive. We don't have a Final version of Hibernate Reactive ...
Read more >
JDK17 compatibility · Issue #3168 · FasterXML/jackson-databind
Jackson core itself does not force access to JDK, but to access fields, getters, setters, constructors, introspection is used. ClassUtil specifically gets ...
Read more >
Every changes between JDK 11 and the Java 17 LTS release
Wondering what's included in the new Java 17 LTS release? Here's a list of all the changes made to the JDK between the...
Read more >
Java 17 features: A comparison between versions 8 and 17
Many products offer migration guides or at least extensive release notes for the Java 9-compatible version. See a nice article from OSGI or ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found