Closed aleksvidak closed 6 months ago
@aleksvidak which version of the plugin are you using? Can you please share an example of how the setter looks like in the target class?
When I try it with something like
public class Target {
public void setSettlementDate(String value) {
//...
}
}
then the set
is not removed. It looks like:
@aleksvidak Is your target DTO a java record?
@thunderhook yes, dto is a record.
@thunderhook could you reproduce this with a record? I can't, it looks correct to me.
@aleksvidak which version of the plugin are you using?
@filiphr Yes I am seeing the same warning in this test class:
import org.mapstruct.Mapper;
@Mapper
interface Issue192Mapper {
Target map(Source source);
}
class Source {
String settlementDate;
}
record Target(String settlementDate) {}
However, I was not able to reproduce this in a unit test yet.
Warning is also shown when using main
with :runIde
however, so this is not fixed yet.
Which IntelliJ are you using locally>? Not the one with :runIde
. I'm on 2024.1 and it is fine there. Might be a bug in IntelliJ
Used IntelliJ IDEA 2023.3.6
- Upgraded now to 2024.1 (Build #IU-241.14494.240)
still there... 🤔
Okay, I'm slightly stupid. My example from above does indeed show the warning, since Source#settlementDate
is not publicly accessible 🤦♂️ Changing it to public String settlementDate;
removes the warning obviously.
@aleksvidak Could you please share your code? We're not able to reproduce this.
My Intellij version is also 2024.1 (Build #IU-241.14494.240)
. Mapstruct version is 1.5.5.Final
.
Seems like @SuperBuilder
annotation is the issue.
@Mapper
interface TestMapper {
Entity toEntity(Dto dto);
}
@SuperBuilder(toBuilder = true)
@Getter
@Setter
@ToString
@NoArgsConstructor
@AllArgsConstructor
class Entity {
private LocalDate settlementDate;
}
record Dto(LocalDate settlementDate) {}
@aleksvidak we had some issues with Lombok's @SuperBuilder
(#159). Version 1.7.0 from the plugin has been released, can you please upgrade it and try it out? If it is still not working as expected will have another look at it.
Seems like it works with 1.7.0, thank you for your help. 🙏🏻 I will close this one now.
I have a property which is named
settlementDate
. It is present in both entity and dto and warning is not correct. Based on the warning message, maybe caused by name starting with 'set'.