orika: Java 10: Warnings: Illegal reflective access: CloneableConverter
What
When starting a spring boot application, using Orika with Java 10, I receive the following warnings:
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by ma.glasnost.orika.converter.builtin.CloneableConverter (file:/xxxr) to method java.lang.Object.clone()
WARNING: Please consider reporting this to the maintainers of ma.glasnost.orika.converter.builtin.CloneableConverter
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Versions I am using Java 10.0.2 and orika-core 1.5.2
How can this issue be solved? I did not check with Java 9 but I expect it to be the same (as with other libraries, which use Reflections).
About this issue
- Original URL
- State: open
- Created 6 years ago
- Reactions: 44
- Comments: 26 (2 by maintainers)
Any chance of releasing the 1.6.0 version any time soon? It’s been 2 years since you have mentioned it.
I mean, it’s only been three years since this was first reported, so nobody could possibly expect any sort of solution in that time frame.
I am using orkia core 1.5.4 latest in maven till now, but I am still getting. Where to get 1.6.X ?
I locally built 1.6.0 branch and used for our project with Java 11 open and it is working fine without any issues
The
WARNING: All illegal access operations will be denied in a future release- part of the error is now becoming reality. In Java 16 orika mapper simply does not work any more*. With the upcoming release of Java 17 (which is an LTS build!), I think the release of version 1.6 is becoming quite important.* Error logs:
Bump
Quick answer: in Java >9 you’ll need to add
--add-opens java.base/java.lang=ALL-UNNAMEDActually this particular converter need to use
.clonemethod if available I removed the need for reflection in builtin converters (ma.glasnost.orika.converter.builtin.CloneableConverter), and the reflection based one will stay there if wanted. This modification should be available in 1.6.0Just keep in mind those warnings wont affect anything. Now a lot of infrastructure code in Java ecosystem are just ignoring those warnings. Some naughty people dared to disable the logger 😅
(from javassist) We will not do that but gradually remove all illegal usages (there is only few places in Orika)