public class BeanMapper {
private static MapperFacade mapper;
static {
MapperFactory mapperFactory = new DefaultMapperFactory.Builder().build();
mapper = mapperFactory.getMapperFacade();
}
public static <S, D> List<D> mapList(Iterable<S> sourceList, Type<S> sourceType, Type<D> destinationType) {
return mapper.mapAsList(sourceList, sourceType, destinationType);
}
public static <E> Type<E> getType(final Class<E> rawType) {
return TypeFactory.valueOf(rawType);
}
}
Execute the following code:
BeanMapper.mapList(list, BeanMapper.getType(Bean1.class), BeanMapper.getType(Bean2.class));
Error stack:
java.lang.StackOverflowError: null
at ma.glasnost.orika.cern.colt.map.OpenIntObjectHashMap.put(OpenIntObjectHashMap.java:329)
at ma.glasnost.orika.cern.colt.map.OpenIntObjectHashMap.put(OpenIntObjectHashMap.java:329)
at ma.glasnost.orika.cern.colt.map.OpenIntObjectHashMap.put(OpenIntObjectHashMap.java:329)
at ma.glasnost.orika.cern.colt.map.OpenIntObjectHashMap.put(OpenIntObjectHashMap.java:329)
at ma.glasnost.orika.cern.colt.map.OpenIntObjectHashMap.put(OpenIntObjectHashMap.java:329)
at ma.glasnost.orika.cern.colt.map.OpenIntObjectHashMap.put(OpenIntObjectHashMap.java:329)
at ma.glasnost.orika.cern.colt.map.OpenIntObjectHashMap.put(OpenIntObjectHashMap.java:329)
at ma.glasnost.orika.cern.colt.map.OpenIntObjectHashMap.put(OpenIntObjectHashMap.java:329)
at ma.glasnost.orika.cern.colt.map.OpenIntObjectHashMap.put(OpenIntObjectHashMap.java:329)
I use version is 1.4.6 maven:
Initial mode:
Execute the following code: BeanMapper.mapList(list, BeanMapper.getType(Bean1.class), BeanMapper.getType(Bean2.class));
Error stack: java.lang.StackOverflowError: null at ma.glasnost.orika.cern.colt.map.OpenIntObjectHashMap.put(OpenIntObjectHashMap.java:329) at ma.glasnost.orika.cern.colt.map.OpenIntObjectHashMap.put(OpenIntObjectHashMap.java:329) at ma.glasnost.orika.cern.colt.map.OpenIntObjectHashMap.put(OpenIntObjectHashMap.java:329) at ma.glasnost.orika.cern.colt.map.OpenIntObjectHashMap.put(OpenIntObjectHashMap.java:329) at ma.glasnost.orika.cern.colt.map.OpenIntObjectHashMap.put(OpenIntObjectHashMap.java:329) at ma.glasnost.orika.cern.colt.map.OpenIntObjectHashMap.put(OpenIntObjectHashMap.java:329) at ma.glasnost.orika.cern.colt.map.OpenIntObjectHashMap.put(OpenIntObjectHashMap.java:329) at ma.glasnost.orika.cern.colt.map.OpenIntObjectHashMap.put(OpenIntObjectHashMap.java:329) at ma.glasnost.orika.cern.colt.map.OpenIntObjectHashMap.put(OpenIntObjectHashMap.java:329)