JDK17 compatibility
See original GitHub issueProblem
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:
- Created 2 years ago
- Comments:29 (4 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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
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.