Skip to content

Ignored mappings when using @InheritConfiguration #3361

@ymanvieu

Description

@ymanvieu

Expected behavior

When using @InheritConfiguration, if compilation succeed, all mappings from the inherited method must be used.

    @Mapping(target = "someAtribute", source = "source.attribute")
    @Mapping(target = "otherAttribute", source = "otherSource.anotherAttribute")
    public abstract Target mapFromSource(Source source, OtherSource otherSource);

    @InheritConfiguration(name = "mapFromSource")
    @Mapping(target = "otherAttribute", source = "source", qualifiedByName = "otherMapping")
    public abstract Target mapInherited(Source source, OtherSource otherSource);

    @Named("otherMapping")
    protected Long otherMapping(Source source) {
        return source.getAttribute() != null ? 1L : 0L;
    }

Actual behavior

from the example, when using mapInherited(), someAtribute mapping is ignored.

Steps to reproduce the problem

It seems that the bug was introduced in 1.4.2 and is still there in 1.5.5

MCVE: https://github.com/ymanvieu/mapstruct-inherit-mapping

MapStruct Version

Mapstruct 1.4.2

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions