You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@johnzon.apache.org by rm...@apache.org on 2014/11/12 11:12:34 UTC

incubator-johnzon git commit: if raw type is Collection we have to handle it. Whatever type we use would be fnie, using ArrayList for now since it looks the most common. If we don't handle it then we can't ask for Collection which would be a pain in

Repository: incubator-johnzon
Updated Branches:
  refs/heads/master c87e427c5 -> 222c5df80


if raw type is Collection we have to handle it. Whatever type we use would be fnie, using ArrayList for now since it looks the most common. If we don't handle it then we can't ask for Collection<xxx> which would be a pain in a lot of cases


Project: http://git-wip-us.apache.org/repos/asf/incubator-johnzon/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-johnzon/commit/222c5df8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-johnzon/tree/222c5df8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-johnzon/diff/222c5df8

Branch: refs/heads/master
Commit: 222c5df80b6999301a49bfb4e27fbbb50301e4ca
Parents: c87e427
Author: Romain Manni-Bucau <rm...@apache.org>
Authored: Wed Nov 12 11:11:56 2014 +0100
Committer: Romain Manni-Bucau <rm...@apache.org>
Committed: Wed Nov 12 11:11:56 2014 +0100

----------------------------------------------------------------------
 .../src/main/java/org/apache/johnzon/mapper/Mapper.java           | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-johnzon/blob/222c5df8/johnzon-mapper/src/main/java/org/apache/johnzon/mapper/Mapper.java
----------------------------------------------------------------------
diff --git a/johnzon-mapper/src/main/java/org/apache/johnzon/mapper/Mapper.java b/johnzon-mapper/src/main/java/org/apache/johnzon/mapper/Mapper.java
index 99262b1..5f3816c 100644
--- a/johnzon-mapper/src/main/java/org/apache/johnzon/mapper/Mapper.java
+++ b/johnzon-mapper/src/main/java/org/apache/johnzon/mapper/Mapper.java
@@ -669,8 +669,7 @@ public class Mapper {
             collection = new HashSet<T>(jsonArray.size());
         } else if (Queue.class == mapping.raw) {
             collection = new ArrayBlockingQueue<T>(jsonArray.size());
-            //fail fast if collection is not know, assume Collection.class to be compatible with ArrayList is wrong for almost all cases
-        } else if (List.class == mapping.raw /*|| Collection.class == mapping.raw*/) {
+        } else if (List.class == mapping.raw || Collection.class == mapping.raw) {
             collection = new ArrayList<T>(jsonArray.size());
         } else {
             throw new IllegalStateException("not supported collection type: " + mapping.raw.getName());