orika-mapper / orika

Simpler, better and faster Java bean mapping framework
http://orika-mapper.github.io/orika-docs/
Apache License 2.0
1.29k stars 268 forks source link

java.lang.StackOverflowError: null #341

Open MoleInTheField opened 4 years ago

MoleInTheField commented 4 years ago

I use version is 1.4.6 maven:

<dependency>
  <groupId>ma.glasnost.orika</groupId>
  <artifactId>orika-core</artifactId>
  <version>1.4.6</version>
</dependency>

Initial mode:

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)

stapetro commented 4 years ago

Can you please show Bean1 & Bean2 classes ?

MoleInTheField commented 4 years ago

Can you please show Bean1 & Bean2 classes ?

same type,same field