-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Labels
Milestone
Description
Expected behavior
My DTO:
public record SomeDto(int id, long number) {
}
I created the follow method for mapping:
SomeDto mapToDto(int id, long number);
I expect that something like this will be generated:
@Override
public SomeDto map(int id, long number) {
int id1 = 0;
id1 = id;
long number1 = 0L;
number1 = number;
SomeDto someDto = new SomeDto( id1, number1 );
return someDto;
}
Actual behavior
For some reason MapStruct tries to check passed parameters for null and it makes it everywhen. So i get the follow implementation of the map method:
@Override
public SomeDto map(int id, long number) {
if ( ) {
return null;
}
int id1 = 0;
id1 = id;
long number1 = 0L;
number1 = number;
SomeDto someDto = new SomeDto( id1, number1 );
return someDto;
}
So there i get compilation error because the condition in the if statement is empty.
Steps to reproduce the problem
Java 17, Spring Boot 2.7.10
DTO:
public record SomeDto(int id, long number) {
}
Mapper:
@Mapper(componentModel = "spring")
public interface SomeMapper {
SomeDto mapToDto(int id, long number);
}
MapStruct Version
1.5.5.Final