-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Description
Expected behavior
Is not very critical but there is an unused import in this case.
import org.mapstruct.Mapper;
@Mapper(componentModel = "spring")
public interface LocalDateTestMapper {
ModelB map(ModelA model);
}
import java.time.LocalDateTime;
import lombok.Data;
@Data
public class ModelA {
private LocalDateTime datetime;
}
import java.time.LocalDate;
import lombok.Data;
@Data
public class ModelB {
private LocalDate datetime;
}
Generated class:
import java.time.LocalDate;
import javax.annotation.processing.Generated;
import org.springframework.stereotype.Component;
@Generated(
value = "org.mapstruct.ap.MappingProcessor",
date = "2024-09-26T22:27:39+0900",
comments = "version: 1.6.2, compiler: Eclipse JDT (IDE) 3.39.0.v20240820-0604, environment: Java 21.0.4 (Eclipse Adoptium)"
)
@Component
public class LocalDateTestMapperImpl implements LocalDateTestMapper {
@Override
public ModelB map(ModelA model) {
if ( model == null ) {
return null;
}
ModelB modelB = new ModelB();
if ( model.getDatetime() != null ) {
modelB.setDatetime( model.getDatetime().toLocalDate() );
}
return modelB;
}
}
Actual behavior
import of localDate is never used
Steps to reproduce the problem
Eclipse 2024-09
mapstruct 1.6.2
spring 5
MapStruct Version
mapstruct 1.6.2