title: Why does this MapStruct generated class does not include import statement?
body: <p>I am using MapStruct to map between JPA entities and POJO DTOs.</p>
  
  <p>All my entities extend a common base class that has an ID field (a <code>java.lang.Long</code>).</p>
  
  <p>I have the following abstract mapper, that allows me to map from relationship in JPA to a simple Long field (or List) in the DTOs. </p>
  
  <p>An entity or <code>List&lt;entity&gt;</code> field can be mapped to a <code>Long</code>/<code>List&lt;Long&gt;</code> field, e.g. <code>User.groups</code> could be mapped to <code>UserDTO.groupIds</code>  :</p>
  
  <pre><code>@Mapper
  public abstract class EntityMapper {
  
      public Long entityToLongId(AbstractBaseEntity entity){
          return entity.getId();
      }
  
      public abstract List&lt;Long&gt; entityCollectionToLongIdList(Collection&lt;? extends AbstractBaseEntity&gt; entities);
  }
  </code></pre>
  
  <p>However the generated implementation class does not include any import statement for the <code>AbstractBaseEntity</code> class, although it is present in the abstract class, so the code does not compile :</p>
  
  <pre><code>package ....;
  
  import java.util.ArrayList;
  import java.util.Collection;
  import java.util.List;
  import javax.annotation.Generated;
  import org.springframework.stereotype.Component;
  
  @Generated(
      value = "org.mapstruct.ap.MappingProcessor",
      date = "2016-07-27T12:11:25+0200",
      comments = "version: 1.0.0.Final, compiler: javac, environment: Java 1.8.0_66 (Oracle Corporation)"
  )
  @Component
  public class EntityMapperImpl extends EntityMapper {
  
      @Override
      public List&lt;Long&gt; entityCollectionToLongIdList(Collection&lt;? extends ch.unine.tango.model.AbstractBaseEntity&gt; entities) {
          if ( entities == null ) {
              return null;
          }
  
          List&lt;Long&gt; list = new ArrayList&lt;Long&gt;();
          for ( AbstractBaseEntity abstractBaseEntity : entities ) { // compilation error here !
              list.add( entityToLongId( abstractBaseEntity ) );
          }
  
          return list;
      }
  }
  </code></pre>
  
  <p>Why is that ? Am I doing it wrong ? How to fix this ?</p>
  
  <p>I am using MapStruct 1.0.0.Final with Java 8.</p>
  
  <p>EDIT: If I add an abstract method that uses the <code>AbstractBaseEntity</code> class directly, then the import is added :</p>
  
  <pre><code>public abstract AbstractBaseEntityDTO entityToDTO(AbstractBaseEntity abstractBaseEntity); 
  </code></pre>
  
  <p>EDIT2: posted the issue on MapStruct's Github : <a href="https://github.com/mapstruct/mapstruct/issues/844" rel="nofollow">https://github.com/mapstruct/mapstruct/issues/844</a></p>