mapstruct / mapstruct-idea

An IntelliJ IDEA plugin for working with MapStruct
Other
136 stars 38 forks source link

#159 support fluent setters with super types (e.g. lomboks @SuperBuilder) #161

Closed thunderhook closed 5 months ago

thunderhook commented 10 months ago

I hope this change has no unwanted side effects. It checks whether a fluent setters return type also can be assigned to one of its super types to support classes like this:

public static abstract class TargetBuilder<C extends Target, B extends TargetBuilder<C, B>> {

            private String testName;

            public B testName(String testName) {
                this.testName = testName;
                return self();
            }
            // ...
}

Fixes #159

filiphr commented 9 months ago

Check my comment in https://github.com/mapstruct/mapstruct-idea/issues/159#issuecomment-1826883528. Is the test code working even properly with the MapStruct processor. We don't really support @SuperBuilder from Lombok, so the fix here will be a bit misleading.

thunderhook commented 6 months ago

@filiphr Could you please have another look? I think it is now valid to support super types like this in the IDE plugin. The example using in the test has the same structure as provided in https://github.com/mapstruct/mapstruct/issues/3524, see https://github.com/mapstruct/mapstruct/pull/3542/files

thunderhook commented 6 months ago

@filiphr Thanks for the feedback. I have made the requested changes.