Illegal reflective access operation warning when using `java.lang.Void` as value type
See original GitHub issueI’m using Jackson (2.9.7) through Spring’s RestTemplate:
ResponseEntity<Void> response = getRestTemplate().exchange(
requestUrl,
HttpMethod.PATCH,
new HttpEntity<>(dto, authHeaders),
Void.class
);
When Void
is used to indicate that the ResponseEntity has no body, the following warning appears in the console:
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.fasterxml.jackson.databind.util.ClassUtil (file:/<snip>repository/com/fasterxml/jackson/core/jackson-databind/2.9.7/jackson-databind-2.9.7.jar) to constructor java.lang.Void()
WARNING: Please consider reporting this to the maintainers of com.fasterxml.jackson.databind.util.ClassUtil
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
The problem disappears if String
is used as generic type.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Java 9 Illegal Reflective Access Warning - Baeldung
The readability of modules is a coarse concept and concerns whether one module has a dependency on another module. The accessibility of modules ......
Read more >How to hide warning "Illegal reflective access" in java 9 ...
1. Simple approach · This approach merges error and output streams. That may not be desirable in some cases. · You cannot redirect...
Read more >Illegal access in Java 16 A.K.A. 'My program crashes!'
WARNING : An illegal reflective access operation has occurred WARNING: Illegal reflective access by org.przybyl.ddj16.
Read more >An illegal reflective access operation has occurred when ...
An illegal reflective access operation has occurred when using Java 11 with ForgeRock products. The purpose of this article is to provide ...
Read more >java - Oracle Help Center
You can use the java command to launch a Java application. ... permit except that a warning message is issued for each illegal...
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 FreeTop 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
Top GitHub Comments
It probably also makes sense to add explicit handling for (nominal) type
Void
. Not much point in introspecting it as POJO. I’ll actually re-open this to have a look.Ok: as an orthogonal thing, I added handling for
Void
as special type to avoid handling of type as POJO; this should prevent warning. There are already handlers for “always read/write asnull
”, as it happens, so not much additional work.