Java / MapStruct Java Interview questions part 2
What happens when MapStruct can't find a matching source property?
If a target property has no corresponding source property (by name, by @Mapping, or via a usable conversion method), MapStruct does not fail silently. By default it emits an "Unmapped target property" compiler warning, naming the property and the method involved, and simply leaves that property unset in the generated code (default value, usually null or zero).
This behavior is configurable through unmappedTargetPolicy on @Mapper: WARN (default), ERROR to fail the build instead, or IGNORE to suppress the message entirely. Teams that want strict mapping coverage often set the policy to ERROR so incomplete mappings can't slip past code review.
More Related questions...