mapstruct-idea
mapstruct-idea copied to clipboard
Inspection to highlight incorrect @Mapping values
It would be great if the plugin could highlight incorrect mappings with an error directly in the editor.
An inspection would be a good way to implement that I think. (For example the user can then enable/disable it, configure the severity and supress it at specific occurrences if needed.)
By incorrect you mean when the target / source do not exist. For example:
class Target {
private String target;
private Nested nested;
}
class Nested {
private String something;
}
and the mapper:
@Mapper
public interface MyMapper {
@Mapping(target = "test", source = "...")
@Mapping(target = "nested.test2", source = "...")
Target map(Source source);
}
The warning / error will be on test and on test2 saying: "Property test does not exist in class Target"
Yes, exactly.