Skip to content

Code completion doesn't work with lombok @SuperBuilder annotation #159

@PyotrSpetsnaz

Description

@PyotrSpetsnaz

Plugin Information

  • Plugin Version: 1.6.1
  • Mapstruct Version: 1.5.5
  • Lombok Version: 1.18.28
  • Java Version: 17
  • IDE Version: Intellij IDEA Ultimate 2023.2.5

Problem Description

The code completion feature of the MapStruct Support plugin is not working properly when using the lombok @SuperBuilder (lombok.experimental.SuperBuilder) annotation.

Steps to Reproduce

  1. Create a new Java class.
  2. Add the lombok @SuperBuilder annotation to the class.
  3. Try to use code completion for any field in @Mapper annotation.

Expected Behavior

When using the @SuperBuilder annotation, the code completion feature should suggest the available fields.

Actual Behavior

The code completion feature does not suggest any fields or methods.

Screenshots and Code Snippets

// Class with annotation
@Getter
@Setter
@SuperBuilder
@NoArgsConstructor
public class Builder {
    private Integer bar;
}
// Class without annotation
@Getter
@Setter
public class WithoutBuilder {
    private Integer foo;
    private Builder innerBuilder; // To show that autocompletion works for inner builders
}
// Mapper with broken code completion
@Mapper
public interface BuilderMapper {
    @Mapping(target = "", source = "")
    Builder map(WithoutBuilder builder);
}

Doesn't work for class with @SuperBuilder:
image
But works for class without @SuperBuilder:
image
Even works for class with @SuperBuilder which inside a class without @SuperBuilder:
image

Additional Information

Generated class for @Mapping(target = "bar", source = "foo") to show that it is valid mapper:

@Generated(
    value = "org.mapstruct.ap.MappingProcessor",
    date = "2023-11-13T17:06:33+0700",
    comments = "version: 1.5.5.Final, compiler: javac, environment: Java 17.0.8 (BellSoft)"
)
public class BuilderMapperImpl implements BuilderMapper {

    @Override
    public Builder map(WithoutBuilder builder) {
        if ( builder == null ) {
            return null;
        }

        Builder builder1 = new Builder();

        builder1.setBar( builder.getFoo() );

        return builder1;
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions