Given the following classes/records and mappers
/* Car.java */
public class Car {
private List<WheelPosition> wheelPositions;
// constructors, getters, setters etc
/* CarDto.java */
public record CarDto(List<String> wheelPositions) {}
/* CarAndWheelMapper.java */
@Mapper
public interface CarAndWheelMapper {
String stringFromWheelPosition(WheelPosition source);
WheelPosition wheelPositionFromString(String source);
CarDto carDtoFromCar(Car source);
Car carFromCarDto(CarDto source);
}
Generates the following error:
<PATH>/CarAndWheelMapper.java:<LINE>: warning: Unmapped target properties: "elPositions".
CarDto carDtoFromCar(Car source);
But the generated Impl is correct:
/* CarAndWheelMapperJavaImpl.java */
@Override
public CarDto carDtoFromCar(Car source) {
if ( source == null ) {
return null;
}
wheelPositions = wheelPositionListToStringList( source.getWheelPositions() );
CarDto carDto = new CarDto( wheelPositions );
return carDto;
}
If I change the CarDto from a record to a class with an all argument constructor and getters the warning disappears.
Java version:
openjdk version "16.0.1" 2021-04-20
OpenJDK Runtime Environment AdoptOpenJDK-16.0.1+9 (build 16.0.1+9)
OpenJDK 64-Bit Server VM AdoptOpenJDK-16.0.1+9 (build 16.0.1+9, mixed mode, sharing)
Given the following classes/records and mappers
Generates the following error:
But the generated Impl is correct:
If I change the
CarDtofrom arecordto aclasswith an all argument constructor and getters the warning disappears.Java version: