Skip to content

ADDED_PREFFERED should fallback to SETTER_PREFERRED when direct list mapping is given #4029

Description

@altaiezior

Expected behavior

Currently we can control ADDER_PREFERRED at mapper or mapper config level

We might have set ADDER_PREFERRED for the whole mapper, but also have provided the direct mapping to the collection, so for example:

@Value
@Builder
class A {
     @Singular("addValue")
     List<String> values;
}
@Value
@Builder
class B {
     Map<String, String> values;
}
@Value
@Builder
class C {
    List<Integer> values;
}
interface CustomMapper {
    A map(B b); // this fails, ideally it can fallback to setter
    A map(C c); // this uses adder

    List<String> map(Map<String, String> map) {
         // custom logic
    }
}

Actual behavior

No response

Steps to reproduce the problem

Mentioned the reproducer above

MapStruct Version

1.6.3

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions