This is an automated email from the ASF dual-hosted git repository.

rmannibucau pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/johnzon.git


The following commit(s) were added to refs/heads/master by this push:
     new d920e1c  JOHNZON-253 tolerate List without generic
d920e1c is described below

commit d920e1cc43049634e992d1c7d1c6541435e12e16
Author: Romain Manni-Bucau <rmannibu...@apache.org>
AuthorDate: Wed Aug 14 10:44:12 2019 +0200

    JOHNZON-253 tolerate List without generic
---
 .../java/org/apache/johnzon/mapper/MappingParserImpl.java  | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git 
a/johnzon-mapper/src/main/java/org/apache/johnzon/mapper/MappingParserImpl.java 
b/johnzon-mapper/src/main/java/org/apache/johnzon/mapper/MappingParserImpl.java
index 581cf21..83005b0 100644
--- 
a/johnzon-mapper/src/main/java/org/apache/johnzon/mapper/MappingParserImpl.java
+++ 
b/johnzon-mapper/src/main/java/org/apache/johnzon/mapper/MappingParserImpl.java
@@ -195,10 +195,16 @@ public class MappingParserImpl implements MappingParser {
 
             JsonArray jsonArray = (JsonArray) jsonValue;
 
-            if (Class.class.isInstance(targetType) && ((Class) 
targetType).isArray()) {
-                final Class componentType = ((Class) 
targetType).getComponentType();
-                return (T) buildArrayWithComponentType(jsonArray, 
componentType, config.findAdapter(componentType),
-                        isDeduplicateObjects ? new JsonPointerTracker(null, 
"/") : null, Object.class);
+            if (Class.class.isInstance(targetType)) {
+                final Class<?> asClass = (Class) targetType;
+                if (asClass.isArray()) {
+                    final Class componentType = asClass.getComponentType();
+                    return (T) buildArrayWithComponentType(jsonArray, 
componentType, config.findAdapter(componentType),
+                            isDeduplicateObjects ? new 
JsonPointerTracker(null, "/") : null, Object.class);
+                }
+                if (Collection.class.isAssignableFrom(asClass)) {
+                    return readObject(jsonValue, new 
JohnzonParameterizedType(asClass, Object.class), applyObjectConverter);
+                }
             }
             if (ParameterizedType.class.isInstance(targetType)) {
 

Reply via email to