title: ModelMapper changes generic type on runtime - weird behavior
body: <p>I am facing a very strange behavior in Java.
  I got two different classes that has no hierarchical connection:
  Class Template (Type hierarchy is Object -> A ->  B -> Template), and class TemplateDto (Object -> TemplateDto).</p>
  
  <p>I am using ModelMapper (org.modelmapper.ModelMapper) for mapping between the two classes (which uses the default mapping since the field names are identical).</p>
  
  <p>There is the following code:</p>
  
  <pre><code>List&lt;Template&gt; templates = cvService.getTemplates();
  List&lt;TemplateDto&gt; resultDtos = new ArrayList&lt;TemplateDto&gt;();
  modelMapper.map(templates,resultDtos);
  TemplateDto example = resultDtos.get(0);
  </code></pre>
  
  <p>And the last line throws:</p>
  
  <pre><code>java.lang.ClassCastException: com.vs.framework.domain.cv.Template cannot be cast to com.vs.framework.dto.cv.TemplateDto
  </code></pre>
  
  <p>This is very weird. When i am debugging this section i see that after the mapping, resultDtos is a list of type List instead of List which blows my mind.</p>
  
  <p>I have tried to clean my tomcat, maven clean install but it still happens.</p>
  
  <p>Any ideas?</p>