import lombok.Getter;
import lombok.With;

@With
@Getter
public class WitherExample {

    private String matchingTypeParameter;
    private String differentTypeParameter;

    public WitherExample() {
        this.matchingTypeParameter = null;
        this.differentTypeParameter = null;
    }

    public WitherExample(String matchingTypeParameter, String differentTypeParameter) {
        this.matchingTypeParameter = matchingTypeParameter;
        this.differentTypeParameter = differentTypeParameter;
    }

    /*
     * Intellij GUI displays a compilation warning for this method when it should not.
     * The warning states that the same method signature is already defined in the class (Lombok @With),
     * however this is not the case when actually compiled.
     * The method `withMatchingTypeParameter(String matchingTypeParameter)` is never generated by Lombok as the below method is defined with the same name.
     */
    public WitherExample withMatchingTypeParameter(String matchingTypeParameter) {
        this.matchingTypeParameter = matchingTypeParameter;
        return this;
    }

    /*
     * When calling this method Intellij GUI displays two options when it should only display one
     * An option is given for `withDifferentTypeParameter(String differentTypeParameter)`,
     * however that method is never generated by Lombok as the below method is defined with the same name.
     */
    public WitherExample withDifferentTypeParameter(int differentTypeParameter) {
        this.differentTypeParameter = String.valueOf(differentTypeParameter);
        return this;
    }

    public static void main(String[] args) {
        WitherExample underTest = new WitherExample("value", "123");
        underTest.withDifferentTypeParameter(1);
        underTest.withDifferentTypeParameter<error descr="'withDifferentTypeParameter(int)' in 'WitherExample' cannot be applied to '(java.lang.String)'">("not valid")</error>;
    }
}