@@ -214,9 +214,9 @@ public Object readByType(@Nullable Field owner, @Nullable Object holder, Type ty
214214 }
215215 } else if (type instanceof Class <?> clazz ) {
216216 if (Map .class .isAssignableFrom (clazz )) {
217- return this .readMap (owner );
218- } else if (List .class .isAssignableFrom (clazz )) {
219- return this .readList (owner );
217+ return this .readMapByType (owner , type );
218+ } else if (Collection .class .isAssignableFrom (clazz )) {
219+ return this .readCollectionByType (owner , type , clazz );
220220 } else if (String .class .isAssignableFrom (clazz )) {
221221 return this .readString (owner );
222222 } else if (Character .class .isAssignableFrom (clazz ) || char .class .isAssignableFrom (clazz )) {
@@ -257,8 +257,8 @@ public Object readByType(@Nullable Field owner, @Nullable Object holder, Type ty
257257 }
258258
259259 @ SuppressFBWarnings ("NP_LOAD_OF_KNOWN_NULL_VALUE" )
260- private Collection <Object > readCollectionByType (Field owner , ParameterizedType parameterizedType , Class <?> clazz ) {
261- Type collectionEntryType = GenericUtils .getParameterType (Collection .class , parameterizedType , 0 );
260+ private Collection <Object > readCollectionByType (Field owner , Type type , Class <?> clazz ) {
261+ Type collectionEntryType = GenericUtils .getParameterType (Collection .class , type , 0 );
262262 if (owner != null ) {
263263 CollectionType collectionType = owner .getAnnotation (CollectionType .class );
264264 if (collectionType != null ) {
@@ -270,7 +270,7 @@ private Collection<Object> readCollectionByType(Field owner, ParameterizedType p
270270 } catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e ) {
271271 throw new SerializableReadException (e );
272272 }
273- } else {
273+ } else if ( Collection . class . isAssignableFrom ( owner . getType ())) {
274274 try {
275275 //noinspection unchecked
276276 return this .readCollection (owner ,
@@ -293,9 +293,9 @@ private Collection<Object> readCollectionByType(Field owner, ParameterizedType p
293293 }
294294
295295 @ SuppressFBWarnings ("NP_LOAD_OF_KNOWN_NULL_VALUE" )
296- private Map <Object , Object > readMapByType (Field owner , ParameterizedType parameterizedType ) {
297- Type mapKeyType = GenericUtils .getParameterType (Map .class , parameterizedType , 0 );
298- Type mapValueType = GenericUtils .getParameterType (Map .class , parameterizedType , 1 );
296+ private Map <Object , Object > readMapByType (Field owner , Type type ) {
297+ Type mapKeyType = GenericUtils .getParameterType (Map .class , type , 0 );
298+ Type mapValueType = GenericUtils .getParameterType (Map .class , type , 1 );
299299 if (owner != null ) {
300300 MapType mapType = owner .getAnnotation (MapType .class );
301301 if (mapType != null ) {
@@ -306,7 +306,7 @@ private Map<Object, Object> readMapByType(Field owner, ParameterizedType paramet
306306 } catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e ) {
307307 throw new SerializableReadException (e );
308308 }
309- } else {
309+ } else if ( Map . class . isAssignableFrom ( owner . getType ())) {
310310 try {
311311 //noinspection unchecked
312312 return this .readMap (owner ,
0 commit comments