Interface inherited build method is not found
Expected behavior
I have a weird setup, I'm mapping from my own dto to a libraries equivalent dto. The library has builders for its entities, however their builders are exposed via an interface that extends another interface that contains a generic build method. I would expect this build method to be found and used.
Actual behavior
I get a compilation error "Person does not have an accessible constructor."
Steps to reproduce the problem
// provided by library public interface EntityBuilder<T> { T build(); } // provided by library public class Person { private final String name; private Person(String name) { this.name = name; } public static Builder builder() { return new BuilderImpl(); } public interface Builder extends EntityBuilder<Person> { Builder name(String name); } private static final class BuilderImpl implements Builder { private String name; private BuilderImpl() { } public Builder name(String name) { this.name = name; return this; } @Override public Person build() { return new Person(name); } } } //my own dto public record PersonDto(String name) { } @Mapper public interface PersonMapper { Person map(PersonDto source); }
From my quick debugging it looks like the problem is that https://github.com/mapstruct/mapstruct/blob/main/processor/src/main/java/org/mapstruct/ap/spi/DefaultBuilderProvider.java#L240 does not yield the build method
MapStruct Version
1.5.5.Final