[JOHNZON-318] ensure List<Object> and List<JsonValue> works even when not integers
diff --git a/johnzon-jsonb/src/test/java/org/apache/johnzon/jsonb/JohnzonJsonbTest.java b/johnzon-jsonb/src/test/java/org/apache/johnzon/jsonb/JohnzonJsonbTest.java
index 757359b..759a16a 100644
--- a/johnzon-jsonb/src/test/java/org/apache/johnzon/jsonb/JohnzonJsonbTest.java
+++ b/johnzon-jsonb/src/test/java/org/apache/johnzon/jsonb/JohnzonJsonbTest.java
@@ -20,7 +20,9 @@
 
 import static org.junit.Assert.assertEquals;
 
+import javax.json.Json;
 import javax.json.JsonArray;
+import javax.json.JsonValue;
 import javax.json.bind.Jsonb;
 import javax.json.bind.JsonbBuilder;
 
@@ -28,11 +30,25 @@
 import org.junit.Rule;
 import org.junit.Test;
 
+import java.util.List;
+
 public class JohnzonJsonbTest {
     @Rule
     public final JsonbRule rule = new JsonbRule();
 
     @Test
+    public void listJsonValue() {
+        assertEquals(Json.createValue(1.1),
+                rule.fromJson("{\"value\":[1.1]}", ArrayJsonValueWrapper.class).value.get(0));
+    }
+
+    @Test
+    public void listObject() {
+        assertEquals(1.1, Number.class.cast(
+                rule.fromJson("{\"value\":[1.1]}", ArrayObjectWrapper.class).value.get(0)).doubleValue(), 0);
+    }
+
+    @Test
     public void jsonArray() throws Exception {
         try (final Jsonb jsonb = JsonbBuilder.create()) {
             final String json = "[{\"foo\":\"bar\"}]";
@@ -63,4 +79,12 @@
             this.value = value;
         }
     }
+
+    public static class ArrayObjectWrapper {
+        public List<Object> value;
+    }
+
+    public static class ArrayJsonValueWrapper {
+        public List<JsonValue> value;
+    }
 }
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 25a5134..7acdd67 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
@@ -478,16 +478,13 @@
             final long longValue = jsonNumber.longValue();
             if (intValue == longValue) {
                 return intValue;
-            } else {
-                return longValue;
             }
-        } else {
-            if (config.isUseBigDecimalForFloats()) {
-                return jsonNumber.bigDecimalValue();
-            } else {
-                return jsonNumber.doubleValue();
-            }
+            return longValue;
         }
+        if (config.isUseBigDecimalForFloats()) {
+            return jsonNumber.bigDecimalValue();
+        }
+        return jsonNumber.doubleValue();
     }
 
     private Object convertTo(final Adapter converter, final JsonValue jsonValue, final JsonPointerTracker jsonPointer,
@@ -644,7 +641,7 @@
         }
 
         if (JsonObject.class.isInstance(jsonValue)) {
-            if (JsonObject.class == type || JsonStructure.class == type) {
+            if (JsonObject.class == type || JsonStructure.class == type || JsonValue.class == type) {
                 return jsonValue;
             }
             final boolean typedAdapter = !ConverterAdapter.class.isInstance(itemConverter) && TypeAwareAdapter.class.isInstance(itemConverter);
@@ -655,12 +652,12 @@
                     jsonPointer);
             return typedAdapter ? itemConverter.to(object) : object;
         } else if (JsonArray.class.isInstance(jsonValue)) {
-            if (JsonArray.class == type || JsonStructure.class == type) {
+            if (JsonArray.class == type || JsonStructure.class == type || JsonValue.class == type) {
                 return jsonValue;
             }
             return buildArray(type, JsonArray.class.cast(jsonValue), itemConverter, null, jsonPointer, rootType);
         } else if (JsonNumber.class.isInstance(jsonValue)) {
-            if (JsonNumber.class == type) {
+            if (JsonNumber.class == type || JsonValue.class == type) {
                 return jsonValue;
             }
 
@@ -686,12 +683,12 @@
                 return number.bigDecimalValue();
             }
 
-            int intValue = number.intValueExact();
             if (type == Integer.class || type == int.class) {
-                return intValue;
+                return number.intValueExact();
             }
 
             if (type == Short.class || type == short.class) {
+                final int intValue = number.intValue();
                 short shortVal = (short) intValue;
                 if (intValue != shortVal) {
                     throw new java.lang.ArithmeticException("Overflow");
@@ -700,12 +697,13 @@
             }
 
             if (type == Byte.class || type == byte.class) {
+                final int intValue = number.intValueExact();
                 Validator.validateByte(intValue);
                 return (byte) intValue;
             }
 
         } else if (JsonString.class.isInstance(jsonValue)) {
-            if (JsonString.class == type) {
+            if (JsonString.class == type || JsonValue.class == type) {
                 return jsonValue;
             }