Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Mapstruct explicit Builder disable #67

Closed
miclefebvre opened this issue Mar 15, 2021 · 3 comments · Fixed by #81
Closed

Support for Mapstruct explicit Builder disable #67

miclefebvre opened this issue Mar 15, 2021 · 3 comments · Fixed by #81
Labels
Milestone

Comments

@miclefebvre
Copy link

Using lombok @builder with some @Singular properties shows warning of unmapped properties in the Intellij plugin.
Ex: If I have a property named baskets and singular, a new property basket is available in the builder and the plugin is saying it needs to be mapped.

Even, disabling the builder, the plugin continue to show warning :builder = @org.mapstruct.Builder(disableBuilder = true)

@filiphr filiphr transferred this issue from mapstruct/mapstruct Mar 15, 2021
@filiphr
Copy link
Member

filiphr commented Mar 15, 2021

Seems like this is an issue for the IntelliJ plugin.

Can you please provide a code with which we can reproduce the issue?

@miclefebvre
Copy link
Author

miclefebvre commented Mar 16, 2021

Here an example. There's a warning saying unmapped property example (examples is correctly mapped, but there's another property example in the builder because of the @Singular)

(Note: I did everything in an inner class for ease of testing, but it does the same thing without the inner class.

@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class Example {
	@Singular private List<ExampleDto> examples;

	@Mapper(builder = @org.mapstruct.Builder(disableBuilder = true))
	public interface ExampleMapper {
		ExampleMapper INSTANCE = Mappers.getMapper( ExampleMapper.class );

		Example convert(Example example);
	}

	@Data
	@NoArgsConstructor
	@AllArgsConstructor
	@Builder
	public static class ExampleDto {
		private String name;
	}
}

The generated mapper seem to be ok, it uses the setters ans there's no property example, so it must be related to the plugin:

public class Example$ExampleMapperImpl implements ExampleMapper {

    @Override
    public Example convert(Example example) {
        if ( example == null ) {
            return null;
        }

        Example example1 = new Example();

        List<ExampleDto> list = example.getExamples();
        if ( list != null ) {
            example1.setExamples( new ArrayList<ExampleDto>( list ) );
        }

        return example1;
    }
}

@filiphr filiphr changed the title Using lombok with builder and @singular shows warnings Support for Mapstruct explicit Builder disable Aug 22, 2021
filiphr added a commit that referenced this issue Aug 22, 2021
@filiphr
Copy link
Member

filiphr commented Aug 22, 2021

@miclefebvre I've changed the title of this issue since the plugin does not support the MapStruct Builder#disable currently. Therefore, you have that problem with Lombok.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants