From b413dbb137ebeff1b0e4cb8f8c89e0f4967cdace Mon Sep 17 00:00:00 2001 From: Gelin Luo Date: Sun, 17 Oct 2021 13:02:10 +1100 Subject: [PATCH] Lang.fieldsOf returned list is not threadsafe #245 --- CHANGELOG.md | 4 ++++ VERSION_MATRIX.md | 2 +- src/main/java/org/osgl/Lang.java | 2 +- src/main/java/org/osgl/util/Generics.java | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 84d4a775..e0313a22 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # OSGL Tool Change Log +1.26.3 +* Lang.fieldsOf returned list is not threadsafe #245 +* Making + 1.26.2 - 01/Jan/2021 * Improve XML to JSON convert logic #243 diff --git a/VERSION_MATRIX.md b/VERSION_MATRIX.md index 009528b0..f0156aa1 100644 --- a/VERSION_MATRIX.md +++ b/VERSION_MATRIX.md @@ -9,7 +9,7 @@ | excel | 1.5.0 | 1.5.0 | 1.6.0 | 1.8.0 | 1.8.0 | 1.9.0 | 1.10.1 | 1.10.2 | | excel-java7 | | | | | | | 1.10.1 | 1.10.2 | | genie | 1.9.3 | 1.9.4 | 1.10.0 | 1.12.0 | 1.12.0 | 1.13.0 | 1.13.1 | 1.13.2 | -| http | 1.9.0 | 1.9.0 | 1.10.0 | 1.11.0 | 1.12.0 | 1.13.0 | 1.13.1 | 1.13.2 | +| http | 1.9.0 | 1.9.0 | 1.10.0 | 1.11.0 | 1.12.0 | 1.13.0 | 1.13.1 | 1.13.3 | | logging | 1.3.0 | 1.3.0 | 1.4.0 | 1.5.0 | 1.5.0 | 1.5.0 | 1.5.0 | 1.5.1 | | mvc | 1.9.0 | 1.9.0 | 1.10.0 | 1.11.0 | 1.11.0 | 1.13.0 | 1.13.1 | 1.13.2 | | storage | 1.8.0 | 1.8.0 | 1.9.0 | 1.10.0 | 1.10.0 | 1.10.0 | 1.11.0 | 1.11.1 | diff --git a/src/main/java/org/osgl/Lang.java b/src/main/java/org/osgl/Lang.java index 8028d821..999962c0 100644 --- a/src/main/java/org/osgl/Lang.java +++ b/src/main/java/org/osgl/Lang.java @@ -7976,7 +7976,6 @@ public static List fieldsOf(Class c, Class rootClass, boolean inclu List fields = cache().get(key); if (null == fields) { fields = new ArrayList<>(); - cache().put(key, fields); $.Predicate filter = noStatic ? new $.Predicate() { @Override public boolean test(Field field) { @@ -7984,6 +7983,7 @@ public boolean test(Field field) { } } : null; addFieldsToList(fields, c, rootClass, includeRootClass, filter); + cache().put(key, fields); } return fields; } diff --git a/src/main/java/org/osgl/util/Generics.java b/src/main/java/org/osgl/util/Generics.java index c5ca26ee..9f6d6559 100644 --- a/src/main/java/org/osgl/util/Generics.java +++ b/src/main/java/org/osgl/util/Generics.java @@ -138,7 +138,7 @@ public static void buildTypeParamImplLookup(Class theClass, Map l buildTypeParamImplLookup(theClass.getSuperclass(), lookup); } - private static void buildTypeParamImplLookup(String prefix, Type[] typeParams, TypeVariable[] typeArgs, Map lookup) { + public static void buildTypeParamImplLookup(String prefix, Type[] typeParams, TypeVariable[] typeArgs, Map lookup) { int len = typeParams.length; for (int i = 0; i < len; ++i) { Type typeParam = typeParams[i];