johnzon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Romain Manni-Bucau (Jira)" <j...@apache.org>
Subject [jira] [Commented] (JOHNZON-347) Mapper.write(Array|Object)() fails on JDK 17
Date Fri, 02 Jul 2021 05:43:00 GMT

    [ https://issues.apache.org/jira/browse/JOHNZON-347?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17373242#comment-17373242
] 

Romain Manni-Bucau commented on JOHNZON-347:
--------------------------------------------

[~christoph.dreis] yes, it is under vote: http://mail-archives.apache.org/mod_mbox/johnzon-dev/202107.mbox/browser

> Mapper.write(Array|Object)() fails on JDK 17
> --------------------------------------------
>
>                 Key: JOHNZON-347
>                 URL: https://issues.apache.org/jira/browse/JOHNZON-347
>             Project: Johnzon
>          Issue Type: Bug
>          Components: Mapper
>    Affects Versions: 1.2.13
>            Reporter: Christoph Dreis
>            Priority: Critical
>         Attachments: diff-jsonpointer.git.patch
>
>
> Hi,
> I've noticed that Mapper.writeArray fails on JDK 17 due to [https://openjdk.java.net/jeps/403] strongly
encapsulating internals now. To reproduce just run `JohnzonJsonbTest` with JDK 17 (build 25
at least to include JEP 403). You will see stacktraces like the following:
> ```
> java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.lang.Object[]
java.util.Arrays$ArrayList.a accessible: module java.base does not "opens java.util" to unnamed
module @4361bd48java.lang.reflect.InaccessibleObjectException: Unable to make field private
final java.lang.Object[] java.util.Arrays$ArrayList.a accessible: module java.base does not
"opens java.util" to unnamed module @4361bd48
>  at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:178) at java.base/java.lang.reflect.Field.setAccessible(Field.java:172)
at org.apache.johnzon.mapper.access.FieldAccessMode$FieldDecoratedType.<init>(FieldAccessMode.java:105)
at org.apache.johnzon.mapper.access.FieldAccessMode$FieldReader.<init>(FieldAccessMode.java:169)
at org.apache.johnzon.mapper.access.FieldAccessMode.doFindReaders(FieldAccessMode.java:49)
at org.apache.johnzon.mapper.access.BaseAccessMode.findReaders(BaseAccessMode.java:82) at
org.apache.johnzon.mapper.access.FieldAndMethodAccessMode.doFindReaders(FieldAndMethodAccessMode.java:68)
at org.apache.johnzon.mapper.access.BaseAccessMode.findReaders(BaseAccessMode.java:82) at
org.apache.johnzon.jsonb.JsonbAccessMode.findReaders(JsonbAccessMode.java:468) at org.apache.johnzon.mapper.access.KnownNotOpenedJavaTypesAccessMode.findReaders(KnownNotOpenedJavaTypesAccessMode.java:182)
at org.apache.johnzon.mapper.Mappings.createClassMapping(Mappings.java:475) at org.apache.johnzon.mapper.Mappings.doFindOrCreateClassMapping(Mappings.java:437)
at org.apache.johnzon.mapper.Mappings.findOrCreateClassMapping(Mappings.java:411) at org.apache.johnzon.mapper.Mapper.isDeduplicateObjects(Mapper.java:202)
at org.apache.johnzon.mapper.Mapper.writeObjectWithGenerator(Mapper.java:196) at org.apache.johnzon.mapper.Mapper.writeObject(Mapper.java:189)
at org.apache.johnzon.mapper.Mapper.writeObject(Mapper.java:217) at org.apache.johnzon.mapper.Mapper.writeArray(Mapper.java:104)
at org.apache.johnzon.jsonb.JohnzonJsonb.toJson(JohnzonJsonb.java:390)
> ```
> I didn't find a quick way to fix this, but let me know if I can help.
>  
> Cheers,
> Christoph



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Mime
View raw message