Do not require the usage of opens in a modular app when using records. · Issue #3352 · FasterXML/jackson-databind (original) (raw)
Is your feature request related to a problem? Please describe.
When using records in a Java modular app you must add opens declarations to the module-info.java
for the package which contains the records you want to be serializable/deserializable:
opens some.package to com.fasterxml.jackson.databind;
If you do not do this, when it comes to using an object mapper you will fail to deserialize with the error:
Caused by Failed to call `setAccess()` on Field ...... module <module-name> does not "opens <module-name>" to module com.fasterxml.jackson.databind
Describe the solution you'd like
Since it is a record I would like for there to be no need to provide 'opens' clauses in the module-info.java
file.
I do not know if this is actually possible.