-
-
Notifications
You must be signed in to change notification settings - Fork 41
Closed
Description
When using a java record as a source, the plugin displays a warning:
Unmapped target property: id
even though the mapstruct framework itself does successfully map the record fields.
Moreover, there is no code completion in the source = "" property of @Mapping.
Source code:
@Mapper
public interface RecordMapper {
AClass toClass(ARecord r);
record ARecord(Integer id) {
}
class AClass {
private Integer id;
public AClass() {}
public AClass(Integer id) {this.id = id;}
public Integer getId() {return id;}
public void setId(Integer id) {this.id = id;}
}
}Successfully generated:
public class RecordMapperImpl implements RecordMapper {
@Override
public AClass toClass(ARecord r) {
if ( r == null ) {
return null;
}
AClass aClass = new AClass();
aClass.setId( r.id() );
return aClass;
}
}JDK: 17
Mapstruct version: 1.4.2.Final
IntelliJ Idea version: 2022.1 (Ultimate Edition)
MapStruct Support Idea version: 1.3.1
yannickdeturck, kayukin, iPisces77, fireRising and jhordycg