Closed aleksvidak closed 10 months ago
Hi @aleksvidak
Thank you for the report. I cannot reproduce this. The following sample generates warnings for me (does not matter if mapped from a record or a class):
import org.mapstruct.Mapper;
@Mapper
interface UserRecordMapper {
UserDto mapFromRecord(UserRecord user);
UserDto mapFromClass(UserClass user);
}
record UserRecord(String username, String password) { }
record UserDto(String name, String pw) { }
class UserClass {
public String username;
public String password;
}
Would you be so kind and post your code of User
and UserDto
?
The case is when mapping from record to class.
public record UserDto(String test, String test4) implements Serializable {}
@SuperBuilder(toBuilder = true)
@Getter
@Setter
@ToString
@NoArgsConstructor
@AllArgsConstructor
public class User {
private String test;
private String test2;
private String test3;
}
import org.mapstruct.Mapper;
import org.mapstruct.MappingConstants;
@Mapper(componentModel = MappingConstants.ComponentModel.SPRING)
public interface UserMapper {
User toEntity(UserDto userDto);
UserDto toDto(User user);
}
When removing the @SuperBuilder
from the target object, then the warnings are shown for me.
Can you tell me if this is the case in your code? If yes, then it is due to #159
When removing the
@SuperBuilder
from the target object, then the warnings are shown for me. Can you tell me if this is the case in your code? If yes, then it is due to #159
Yes, when I remove @SuperBuilder
, warnings are back.
Perfect, will be fixed soon in #159. 👍
When mapping from a DTO that is a Java record to entity class, Intellij does not show warning when there are unmapped properties.
During mvn compile, warnings are correctly shown in the console.
Mapstruct version: 1.6.1 Intellij version: 2023.2.5