mapstruct / mapstruct-idea

An IntelliJ IDEA plugin for working with MapStruct
Other
136 stars 38 forks source link

Plugin reports "Can't find related attribute" warning when using `source="."` #187

Closed Chessray closed 5 months ago

Chessray commented 5 months ago

This style of mapping declaration leads to the warning "Can't find related attribute".

@Mapping(target = "value", source = ".")
WrapperObject convert(String rawId);
filiphr commented 5 months ago

@Chessray the use of source = "." is not really documented properly. I think that it works by accident (even in the processor itself). I would instead do source = "rawId" here. Perhaps we need to have a warning or an error for this. in the INtelliJ plugin

Chessray commented 5 months ago

So this is not intended to work in the Processor? That means I've been advising clients about an undocumented feature for years. 😬 The plugin displays a warning which seems to be intended then.