mapstruct / mapstruct-idea

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

Incorrect no source property defined inspection for `@Mapping` #194

Closed filiphr closed 5 months ago

filiphr commented 6 months ago

In #153 we added some more extensive support for inspections on mappings. Seems like we were a bit too eager in those inspections.

An inspection like @Mapping(target = "starred", conditionQualifiedByName = "shouldIncludeStarred") is now reported as an error with "No source property defined". However, this is a completely valid mapping, there are others where something similar might happen.

Perhaps we should only report "No source property defined" when only target is defined. However, even in this case when using in combination with @BeanMapping(ignoreByDefault = true) then something like @Mapping(target = "starred") is a valid mapping as well.