jdereg / json-io

Convert Java to JSON. Convert JSON to Java. Pretty print JSON. Java JSON serializer. Deep copy Java object graphs.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

java.lang primitives serialization - JDK-8256358 - JDK 17 support

mvangoor opened this issue · comments

Hi,

In JDK 16 the default for illegal-access switched to deny (was permit) and in 17 this option was removed completely.
For context see:

Basically every java.lang class cannot be serialized anymore and will throw an java.lang.IllegalAccessException starting JDK16 (can be changed) and perm since JDK17.

The Exception is silently ignored at https://github.com/jdereg/json-io/blob/master/src/main/java/com/cedarsoftware/util/io/JsonWriter.java#L2305

I could create a custom writer to call "toString()" for any java.lang primitive, but thought it worth opening an issue to get insight in others thoughts so please respond.

#156 maybe this help, that fix some issues for primitive, better if you can help review..

#156 added and released. @mvangoor - can you verify if json-io 4.14.0, which contains #156, fixes the issue you were having?

@jdereg was this version actually released?
According to https://search.maven.org/artifact/com.cedarsoftware/json-io the latest version is still 4.13.0

Also, the version number in the repo pom.xml is still 4.13.0 I would be happy to help testing the new java17 support. What is the preferred way? Just check it out?

Ah, I assumed there is java 17 support yet and only testing is left, according to #156. You mentioned you released this as 4.14.0? I don't know what is left. First step would be a number of test cases or simply problematic Objects for test cases. I have seen one test yet in the code here.

Has anybody examples for problematic objects?

I am currently aware of (from the issues):

  1. java.lang.primitives (this issue) => should be addressed by #156 according to @wwang-talend
  2. enum serialization #155 => should be addressed by #156 also
  3. Maybe my issue according deserialisation of records #151

Hi @jdereg,

First of all sorry for not responding at all.
I lost track of this issue and somehow the messages to remind me got into some obscure trash folder...

That said I recently stumbled upon this sissue 'again' and found this thread with all nice updates!

I manually built the latest master branch as 4.14.0 and tried it out.
So far all tests are passing and primitives are being handled correctly.

I reached out to a few people to also test it and hope to have a final reply asap.

Again sorry for the delay!

Regards,
Mike

json-io 4.14.0 has been released. The fixes that have been submitted to support JDK through 17 are included. Let me know if you have any issues.

Hi @jdereg ,

Appreciate the reply, especially since I've been awol for soo long... again truly sorry about that.

I checked the tags and maven repository, I do not see a 4.14.0 there.
Am I missing something? :)

Regards,
Mike

Thanks, all looking good now.

Closing :)