Repository: mapstruct/mapstruct (language: java)

Issue:
Unused import of java.time.LocalDate when mapping source LocalDateTime to target LocalDate
### 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


Discussion / hints:

Fix patch:
diff --git a/processor/src/main/java/org/mapstruct/ap/internal/conversion/JavaLocalDateTimeToLocalDateConversion.java b/processor/src/main/java/org/mapstruct/ap/internal/conversion/JavaLocalDateTimeToLocalDateConversion.java
index ae571ad6b0..9116bada4c 100644
--- a/processor/src/main/java/org/mapstruct/ap/internal/conversion/JavaLocalDateTimeToLocalDateConversion.java
+++ b/processor/src/main/java/org/mapstruct/ap/internal/conversion/JavaLocalDateTimeToLocalDateConversion.java
@@ -7,11 +7,8 @@
 
 import java.time.LocalDate;
 import java.time.LocalDateTime;
-import java.util.Set;
 
 import org.mapstruct.ap.internal.model.common.ConversionContext;
-import org.mapstruct.ap.internal.model.common.Type;
-import org.mapstruct.ap.internal.util.Collections;
 
 /**
  * SimpleConversion for mapping {@link LocalDateTime} to
@@ -25,22 +22,9 @@ protected String getToExpression(ConversionContext conversionContext) {
         return "<SOURCE>.toLocalDate()";
     }
 
-    @Override
-    protected Set<Type> getToConversionImportTypes(ConversionContext conversionContext) {
-        return Collections.asSet(
-            conversionContext.getTypeFactory().getType( LocalDate.class )
-        );
-    }
-
     @Override
     protected String getFromExpression(ConversionContext conversionContext) {
         return "<SOURCE>.atStartOfDay()";
     }
 
-    @Override
-    protected Set<Type> getFromConversionImportTypes(ConversionContext conversionContext) {
-        return Collections.asSet(
-            conversionContext.getTypeFactory().getType( LocalDateTime.class )
-        );
-    }
 }


Test patch:
diff --git a/processor/src/test/java/org/mapstruct/ap/test/bugs/_3732/Issue3732Mapper.java b/processor/src/test/java/org/mapstruct/ap/test/bugs/_3732/Issue3732Mapper.java
new file mode 100644
index 0000000000..79b13aa8ce
--- /dev/null
+++ b/processor/src/test/java/org/mapstruct/ap/test/bugs/_3732/Issue3732Mapper.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package org.mapstruct.ap.test.bugs._3732;
+
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+
+import org.mapstruct.Mapper;
+
+/**
+ * @author Filip Hrisafov
+ */
+@Mapper
+public interface Issue3732Mapper {
+
+    Target map(Source source);
+
+    Source map(Target source);
+
+    class Source {
+        private LocalDateTime value;
+
+        public LocalDateTime getValue() {
+            return value;
+        }
+
+        public void setValue(LocalDateTime value) {
+            this.value = value;
+        }
+    }
+
+    class Target {
+
+        private LocalDate value;
+
+        public LocalDate getValue() {
+            return value;
+        }
+
+        public void setValue(LocalDate value) {
+            this.value = value;
+        }
+    }
+}
diff --git a/processor/src/test/java/org/mapstruct/ap/test/bugs/_3732/Issue3732Test.java b/processor/src/test/java/org/mapstruct/ap/test/bugs/_3732/Issue3732Test.java
new file mode 100644
index 0000000000..9dbd9c0bb8
--- /dev/null
+++ b/processor/src/test/java/org/mapstruct/ap/test/bugs/_3732/Issue3732Test.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package org.mapstruct.ap.test.bugs._3732;
+
+import org.mapstruct.ap.testutil.IssueKey;
+import org.mapstruct.ap.testutil.ProcessorTest;
+import org.mapstruct.ap.testutil.WithClasses;
+
+/**
+ * @author Filip Hrisafov
+ */
+@IssueKey("3732")
+@WithClasses({ Issue3732Mapper.class })
+class Issue3732Test {
+
+    @ProcessorTest
+    void shouldGenerateCorrectMapper() {
+    }
+}