#598 superclass mapping methods now throw errors/warnings on mapper class. by Zegveld · Pull Request #2608 · mapstruct/mapstruct
I agree with that the current solutions isn't the best one, I've been thinking about another way for a while including what you mentioned but so far I haven't been able to get that route working without duplicating a lot of code. Seeing as I'm not a fan of code duplication I'm not willing to put that solution forward.
My new idea is to use a decorator pattern on the Message object as well as on the FormattingMessager.
This would basically mean that the Message object gets an interface which will be implemented by both the current enum, and the decorator. The decorator is constructed by putting an object matching the interface in it, and most of the functionality will be passed through, except for the bits that we want to adjust. These bits are the message location (Edit: at the FormattingMessager) and an extension to the message text (Edit: at the Message).
Originally I tried to use the decorator pattern purely on the FormattingMessager itself, but that didn't work out that well. But if I combine a decorator on the FormattingMessager with a decorator on the Message object, then I should be able to get it working nicely. Also this will allow a bit more flexibility with messages enhancement in the future.
Going to work on this idea during the coming weekend, if I have time.
(Edit: This PR got automatically closed because I forced the changes away. 😸 )