-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Some Collection
and Map
fallbacks don't work in GraalVM native image
#4299
Comments
Interesting. I would have thought dependency via I am open to suggestions for solution here. |
It helps with classes it creates, but these are only |
Ok. So those types are found at least. And due to defaulting, I guess adding support for others seems sensible too. |
BTW, I added a simple but close-to-real reproducer for this issue at https://github.com/edudar/feign-native. It fails with the default Jackson version (2.15.3) and succeeds with a locally built 2.17.0 snapshot. |
Thanks @edudar that is a good validation; important to know fix actually works for intended problem. Aside from CLA for PR, the only thing I really was hoping to clarify was whether eager construction of |
Eager instantiation is not required for the fix. The main difference is explicit instantiation vs. reflection via default constructor. |
Collection
and Map
fallbacks don't work in GraalVM native image
Thank you @edudar ! If possible, could you check that the resulting version (2.17.0-SNAPSHOT) works as expected? (if you haven't already done so). I assume it does, just want to make sure. |
Is your feature request related to a problem? Please describe.
I'm trying to run a service compiled with GraalVM into a native image. The service does not reference or create
HashSet
explicitly and usesSet
in all DTOs instead. Upon deserialization, an exception happens that says that "java.util.HashSet can't be created because no creator, like default constructor, exists". Those are removed by dead code elimination as none are registered for reflection or used explicitly, andContainerDefaultMappings
provides just a class reference that is used later to create a given set vianewInstance
.Describe the solution you'd like
My current solution using Spring Boot is to simply register these classes for reflection:
This is not perfect, though.
Another approach might be to create appropriate value instantiators in
JDKValueInstantiators
for every fallback collection as they specifically tell what constructor will be used.Usage example
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: