From aa663e6e8135935af0efc47d5cb4a872b0559cb4 Mon Sep 17 00:00:00 2001 From: knecht Date: Fri, 24 Apr 2020 11:01:31 +0200 Subject: [PATCH 01/12] add JsoniterSpi.clearCaches since the cache may contain entries referring to classes whose classloader is disposed, there must be a way to get rid of them --- src/main/java/com/jsoniter/spi/JsoniterSpi.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/com/jsoniter/spi/JsoniterSpi.java b/src/main/java/com/jsoniter/spi/JsoniterSpi.java index 7f505e1a..e68f7d43 100644 --- a/src/main/java/com/jsoniter/spi/JsoniterSpi.java +++ b/src/main/java/com/jsoniter/spi/JsoniterSpi.java @@ -291,6 +291,15 @@ private synchronized static void addObjectFactory(Class clazz, Extension extensi objectFactories = copy; } + public static synchronized void clearCaches() { + mapKeyEncoders = new HashMap<>(); + mapKeyDecoders = new HashMap<>(); + encoders = new HashMap<>(); + decoders = new HashMap<>(); + objectFactories = new HashMap<>(); + } + + private static class TypeProperty { public final Type type; From dc3a7af03896e86d08451cb00c5a2dda01db2bd4 Mon Sep 17 00:00:00 2001 From: Brix Date: Sat, 13 Aug 2022 02:49:21 +0200 Subject: [PATCH 02/12] Modularized, Java17, dependency-updates. --- DependencyUpdateSearch_Rules.xml | 15 +++++ pom.xml | 66 +++++++++++++++---- src/main/java/module-info.java | 29 ++++++++ .../java/com/jsoniter/output/TestNested.java | 18 ++--- 4 files changed, 104 insertions(+), 24 deletions(-) create mode 100644 DependencyUpdateSearch_Rules.xml create mode 100644 src/main/java/module-info.java diff --git a/DependencyUpdateSearch_Rules.xml b/DependencyUpdateSearch_Rules.xml new file mode 100644 index 00000000..77cc7db8 --- /dev/null +++ b/DependencyUpdateSearch_Rules.xml @@ -0,0 +1,15 @@ + + + + + (?i).*Alpha(?:-?\d+)? + (?i).*a(?:-?\d+)? + (?i).*Beta(?:-?\d+)? + (?i).*-B(?:-?\d+)? + (?i).*RC(?:-?\d+)? + (?i).*CR(?:-?\d+)? + (?i).*M(?:-?\d+)? + + + + diff --git a/pom.xml b/pom.xml index fe0bd30c..9d387c28 100644 --- a/pom.xml +++ b/pom.xml @@ -40,7 +40,7 @@ junit junit - 4.12 + 4.13.2 test @@ -52,38 +52,38 @@ com.fasterxml.jackson.core jackson-annotations - 2.9.5 + 2.13.3 true com.fasterxml.jackson.core jackson-databind - 2.9.5 + 2.13.3 true com.google.code.gson gson - 2.8.3 + 2.9.1 true org.openjdk.jmh jmh-core - 1.20 + 1.35 test org.openjdk.jmh jmh-generator-annprocess - 1.20 + 1.35 test org.apache.commons commons-lang3 - 3.5 + 3.12.0 test @@ -125,16 +125,16 @@ org.apache.maven.plugins maven-compiler-plugin - 3.7.0 + 3.10.1 - 16 + 17 UTF-8 org.apache.maven.plugins maven-source-plugin - 3.0.1 + 3.2.1 attach-sources @@ -147,7 +147,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.0.0 + 3.4.0 attach-javadocs @@ -177,7 +177,7 @@ org.sonatype.plugins nexus-staging-maven-plugin - 1.6.8 + 1.6.13 true ossrh @@ -199,7 +199,7 @@ org.apache.maven.plugins maven-surefire-plugin - 2.21.0 + 2.20 true methods @@ -215,6 +215,46 @@ + + + org.codehaus.mojo + versions-maven-plugin + 2.11.0 + + file:///${project.basedir}/DependencyUpdateSearch_Rules.xml + + + + verify + + display-dependency-updates + display-plugin-updates + + + + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.1.0 + + + enforce-maven + + enforce + + + + + [3.3.2,) + + + + + + + diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java new file mode 100644 index 00000000..2ba445b9 --- /dev/null +++ b/src/main/java/module-info.java @@ -0,0 +1,29 @@ +open module com.jsoniter { + exports com.jsoniter.fuzzy; + + exports com.jsoniter.static_codegen; + + exports com.jsoniter.extra; + + exports com.jsoniter.output; + + exports com.jsoniter.annotation; + + exports com.jsoniter; + + exports com.jsoniter.spi; + + exports com.jsoniter.any; + + requires com.fasterxml.jackson.annotation; + + requires com.fasterxml.jackson.core; + + requires com.fasterxml.jackson.databind; + + requires com.google.gson; + + requires java.desktop; + + requires javassist; +} \ No newline at end of file diff --git a/src/test/java/com/jsoniter/output/TestNested.java b/src/test/java/com/jsoniter/output/TestNested.java index 00fd8d6d..e3750c66 100644 --- a/src/test/java/com/jsoniter/output/TestNested.java +++ b/src/test/java/com/jsoniter/output/TestNested.java @@ -1,16 +1,12 @@ package com.jsoniter.output; +import java.io.*; +import java.util.*; + import com.jsoniter.annotation.JsonProperty; -import com.jsoniter.spi.JsoniterSpi; -import com.jsoniter.spi.TypeLiteral; -import junit.framework.TestCase; +import com.jsoniter.spi.*; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import junit.framework.TestCase; public class TestNested extends TestCase { @@ -45,7 +41,7 @@ public void test_collection_of_objects() throws IOException { obj1.field1 = "1"; obj1.field2 = "2"; String output = JsonStream.serialize(new TypeLiteral>() { - }, new ArrayList() {{ + }, new ArrayList<>() {{ add(obj1); }}); assertTrue(output.contains("field1")); @@ -92,7 +88,7 @@ public void test_map_of_objects() throws IOException { obj1.field1 = "1"; obj1.field2 = "2"; stream.writeVal(new TypeLiteral>() { - }, new HashMap() {{ + }, new HashMap<>() {{ put("hello", obj1); }}); stream.close(); From e736444298941b6621d12913cd60e60590cc08a4 Mon Sep 17 00:00:00 2001 From: Brix Date: Sat, 13 Aug 2022 03:05:06 +0200 Subject: [PATCH 03/12] trying source and target tags to try to fix jitpack.io compilation problem --- pom.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pom.xml b/pom.xml index 9d387c28..c0824ddf 100644 --- a/pom.xml +++ b/pom.xml @@ -128,6 +128,8 @@ 3.10.1 17 + 17 + 17 UTF-8 From bdbd720b655dcdd25d5ee73f2e1c43f1116b6a5f Mon Sep 17 00:00:00 2001 From: Brix Date: Sat, 13 Aug 2022 03:37:49 +0200 Subject: [PATCH 04/12] java.lang.module.FindException: Module com.fasterxml.jackson.databind not found, required by com.jsoniter --- src/main/java/module-info.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java index 2ba445b9..04943bae 100644 --- a/src/main/java/module-info.java +++ b/src/main/java/module-info.java @@ -14,16 +14,15 @@ exports com.jsoniter.spi; exports com.jsoniter.any; + + requires transitive com.fasterxml.jackson.annotation; - requires com.fasterxml.jackson.annotation; + requires transitive com.fasterxml.jackson.core; - requires com.fasterxml.jackson.core; - - requires com.fasterxml.jackson.databind; + requires transitive com.fasterxml.jackson.databind; requires com.google.gson; requires java.desktop; - requires javassist; } \ No newline at end of file From 6a90a5a4112778a6dab0cc62f2009ef023833f03 Mon Sep 17 00:00:00 2001 From: Brix Date: Sat, 13 Aug 2022 03:44:46 +0200 Subject: [PATCH 05/12] transitive module Javassist not found --- src/main/java/module-info.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java index 04943bae..c6b4a420 100644 --- a/src/main/java/module-info.java +++ b/src/main/java/module-info.java @@ -20,9 +20,11 @@ requires transitive com.fasterxml.jackson.core; requires transitive com.fasterxml.jackson.databind; + + requires transitive javassist; - requires com.google.gson; + requires transitive com.google.gson; - requires java.desktop; + requires transitive java.desktop; } \ No newline at end of file From 1652d873755d8bde53e6e97a3e90e38099c458b5 Mon Sep 17 00:00:00 2001 From: Brix Date: Sat, 13 Aug 2022 04:04:03 +0200 Subject: [PATCH 06/12] revert transitive and open for more tests --- src/main/java/module-info.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java index c6b4a420..0498d1bf 100644 --- a/src/main/java/module-info.java +++ b/src/main/java/module-info.java @@ -1,4 +1,4 @@ -open module com.jsoniter { +module com.jsoniter { exports com.jsoniter.fuzzy; exports com.jsoniter.static_codegen; @@ -15,16 +15,16 @@ exports com.jsoniter.any; - requires transitive com.fasterxml.jackson.annotation; + requires com.fasterxml.jackson.annotation; - requires transitive com.fasterxml.jackson.core; + requires com.fasterxml.jackson.core; - requires transitive com.fasterxml.jackson.databind; + requires com.fasterxml.jackson.databind; - requires transitive javassist; + requires javassist; - requires transitive com.google.gson; + requires com.google.gson; - requires transitive java.desktop; + requires java.desktop; } \ No newline at end of file From 4fbcbb48d2f2bfef7b6d9fde31da9d64348e334d Mon Sep 17 00:00:00 2001 From: Brix Date: Tue, 16 Aug 2022 22:29:28 +0200 Subject: [PATCH 07/12] fixed module-info using "requires static" for optional and test-only pom-dependencies. --- pom.xml | 2 ++ src/main/java/module-info.java | 28 ++++++++++++++++++---------- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/pom.xml b/pom.xml index c0824ddf..1f1f06da 100644 --- a/pom.xml +++ b/pom.xml @@ -162,6 +162,7 @@ + org.sonatype.plugins nexus-staging-maven-plugin diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java index 0498d1bf..ae3ddf55 100644 --- a/src/main/java/module-info.java +++ b/src/main/java/module-info.java @@ -1,4 +1,7 @@ module com.jsoniter { + + exports com.jsoniter; + exports com.jsoniter.fuzzy; exports com.jsoniter.static_codegen; @@ -9,22 +12,27 @@ exports com.jsoniter.annotation; - exports com.jsoniter; - exports com.jsoniter.spi; exports com.jsoniter.any; - - requires com.fasterxml.jackson.annotation; - requires com.fasterxml.jackson.core; - requires com.fasterxml.jackson.databind; - - requires javassist; + /** static, because marked as optional in pom.xml*/ + requires static javassist; + + /** static, because marked as optional in pom.xml*/ + requires static com.fasterxml.jackson.core; - requires com.google.gson; + /** static, because marked as optional in pom.xml*/ + requires static com.fasterxml.jackson.annotation; + + /** static, because marked as optional in pom.xml*/ + requires static com.fasterxml.jackson.databind; + + /** static, because marked as optional in pom.xml*/ + requires static com.google.gson; - requires java.desktop; + /** static, because only used in testing */ + requires static java.desktop; } \ No newline at end of file From 0451822512b0387d43127729544a6749c90b21db Mon Sep 17 00:00:00 2001 From: Brix Date: Tue, 16 Aug 2022 22:29:28 +0200 Subject: [PATCH 08/12] fixed module-info using "requires static" for optional and test-only pom-dependencies. --- src/main/java/module-info.java | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java index 0498d1bf..ae3ddf55 100644 --- a/src/main/java/module-info.java +++ b/src/main/java/module-info.java @@ -1,4 +1,7 @@ module com.jsoniter { + + exports com.jsoniter; + exports com.jsoniter.fuzzy; exports com.jsoniter.static_codegen; @@ -9,22 +12,27 @@ exports com.jsoniter.annotation; - exports com.jsoniter; - exports com.jsoniter.spi; exports com.jsoniter.any; - - requires com.fasterxml.jackson.annotation; - requires com.fasterxml.jackson.core; - requires com.fasterxml.jackson.databind; - - requires javassist; + /** static, because marked as optional in pom.xml*/ + requires static javassist; + + /** static, because marked as optional in pom.xml*/ + requires static com.fasterxml.jackson.core; - requires com.google.gson; + /** static, because marked as optional in pom.xml*/ + requires static com.fasterxml.jackson.annotation; + + /** static, because marked as optional in pom.xml*/ + requires static com.fasterxml.jackson.databind; + + /** static, because marked as optional in pom.xml*/ + requires static com.google.gson; - requires java.desktop; + /** static, because only used in testing */ + requires static java.desktop; } \ No newline at end of file From ada2ca9546e929abc94b04f529cf897536d33348 Mon Sep 17 00:00:00 2001 From: Brix Date: Wed, 17 Aug 2022 00:40:11 +0200 Subject: [PATCH 09/12] opened module --- src/main/java/module-info.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java index ae3ddf55..57b5d2c8 100644 --- a/src/main/java/module-info.java +++ b/src/main/java/module-info.java @@ -1,4 +1,4 @@ -module com.jsoniter { +open module com.jsoniter { exports com.jsoniter; From 26eab37806fd7bd82b5d4295b350a4b7f32068f7 Mon Sep 17 00:00:00 2001 From: Brix Date: Wed, 17 Aug 2022 00:41:10 +0200 Subject: [PATCH 10/12] opened module --- src/main/java/module-info.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java index ae3ddf55..57b5d2c8 100644 --- a/src/main/java/module-info.java +++ b/src/main/java/module-info.java @@ -1,4 +1,4 @@ -module com.jsoniter { +open module com.jsoniter { exports com.jsoniter; From 74c09dc678c3e9f7f118cba38897920abeac6162 Mon Sep 17 00:00:00 2001 From: Brix Date: Wed, 17 Aug 2022 22:18:53 +0200 Subject: [PATCH 11/12] updated readme for fork --- README.md | 55 +++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 49 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index b621a36c..92bea8c7 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,51 @@ -[![Build Status](https://travis-ci.org/json-iterator/java.svg?branch=master)](https://travis-ci.org/json-iterator/java) -[![codecov](https://codecov.io/gh/json-iterator/java/branch/master/graph/badge.svg)](https://codecov.io/gh/json-iterator/java) -[![License](http://img.shields.io/badge/license-mit-blue.svg?style=flat-square)](https://raw.githubusercontent.com/json-iterator/java/master/LICENSE) -[![Gitter chat](https://badges.gitter.im/gitterHQ/gitter.png)](https://gitter.im/json-iterator/Lobby) -Documentation : [http://jsoniter.com/java-features.html](http://jsoniter.com/java-features.html) +##### Note: this is a fork for a private project that includes PRs for the Java module system abd Java Record classes. I'm not actively supporting this. -Scala User: https://github.com/plokhotnyuk/jsoniter-scala \ No newline at end of file +[![Build Status](https://travis-ci.org/json-iterator/java.svg?branch=master)](https://travis-ci.org/json-iterator/java) +[![codecov](https://codecov.io/gh/json-iterator/java/branch/master/graph/badge.svg)](https://codecov.io/gh/json-iterator/java) +[![License](http://img.shields.io/badge/license-mit-blue.svg?style=flat-square)](https://raw.githubusercontent.com/json-iterator/java/master/LICENSE) +[![Gitter chat](https://badges.gitter.im/gitterHQ/gitter.png)](https://gitter.im/json-iterator/Lobby) + +Documentation : [http://jsoniter.com/java-features.html](http://jsoniter.com/java-features.html) + +Scala User: https://github.com/plokhotnyuk/jsoniter-scala + +To use this fork: + +Add jitpack.io as a repository: + +```xml + + + + false + + central + Central Repository + https://repo.maven.apache.org/maven2 + + + + jitpack.io + https://jitpack.io + + +``` + +Add this dependency, by referring to this Github page: + +```xml + + com.github.Brixomatic + json-iterator-java + master-SNAPSHOT + +``` + +Note: + The Java Module System enhancement has not been tested with jackson, gson or javassist. + You might however vote for this PR in the original project, so it gets more popularity and the remaning problems can be addressed: + [https://github.com/json-iterator/java/pull/325](https://github.com/json-iterator/java/pull/325) + + The original author seems to have abandoned the project though. + From 79764f1a878ce0dbcbc2c9f0b7bc356822f01972 Mon Sep 17 00:00:00 2001 From: Brixomatic <37806303+Brixomatic@users.noreply.github.com> Date: Thu, 18 Aug 2022 17:35:32 +0200 Subject: [PATCH 12/12] Update README.md --- README.md | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 92bea8c7..1e2eeee8 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,17 @@ -##### Note: this is a fork for a private project that includes PRs for the Java module system abd Java Record classes. I'm not actively supporting this. +#### Note: this is a fork for a private project that includes PRs for the Java module system and Java Record classes. I'm not actively supporting this. -[![Build Status](https://travis-ci.org/json-iterator/java.svg?branch=master)](https://travis-ci.org/json-iterator/java) -[![codecov](https://codecov.io/gh/json-iterator/java/branch/master/graph/badge.svg)](https://codecov.io/gh/json-iterator/java) -[![License](http://img.shields.io/badge/license-mit-blue.svg?style=flat-square)](https://raw.githubusercontent.com/json-iterator/java/master/LICENSE) -[![Gitter chat](https://badges.gitter.im/gitterHQ/gitter.png)](https://gitter.im/json-iterator/Lobby) +Original Project status (not this fork): +[![Build Status](https://travis-ci.org/json-iterator/java.svg?branch=master)](https://travis-ci.org/json-iterator/java) +[![codecov](https://codecov.io/gh/json-iterator/java/branch/master/graph/badge.svg)](https://codecov.io/gh/json-iterator/java) +[![License](http://img.shields.io/badge/license-mit-blue.svg?style=flat-square)](https://raw.githubusercontent.com/json-iterator/java/master/LICENSE) +[![Gitter chat](https://badges.gitter.im/gitterHQ/gitter.png)](https://gitter.im/json-iterator/Lobby) Documentation : [http://jsoniter.com/java-features.html](http://jsoniter.com/java-features.html) Scala User: https://github.com/plokhotnyuk/jsoniter-scala -To use this fork: +#### To use this fork: Add jitpack.io as a repository: @@ -42,8 +43,8 @@ Add this dependency, by referring to this Github page: ``` -Note: - The Java Module System enhancement has not been tested with jackson, gson or javassist. +Note: + **The Java Module System enhancement has not been tested with jackson, gson or javassist.** You might however vote for this PR in the original project, so it gets more popularity and the remaning problems can be addressed: [https://github.com/json-iterator/java/pull/325](https://github.com/json-iterator/java/pull/325)