mapstruct-idea icon indicating copy to clipboard operation
mapstruct-idea copied to clipboard

MapStruct Support 1.3.1 Completion of target and source properties in @Mapping can not work

Open daitianci opened this issue 3 years ago • 6 comments

idea version 2020.1.3 ,mapstruct verison 1.5.2.Final MapStruct Support 1.3.1

daitianci avatar Jun 24 '22 09:06 daitianci

Can you please be a bit more specific about what isn't working? The MapStruct version shouldn't affect the completion.

Can you please share an example of your mapper and source / target classes so we can look into it?

filiphr avatar Jun 24 '22 09:06 filiphr

Can you please be a bit more specific about what isn't working? The MapStruct version shouldn't affect the completion.

Can you please share an example of your mapper and source / target classes so we can look into it?

ok,the classes as below

@Data
@AllArgsConstructor
@NoArgsConstructor
public class CompareA {
    private String name;

    private Integer age;

    private LocalDateTime createTime;

    private double score;

    private Double totalScore;

    private Date updateTIme;

    private ChildCompare childCompare;

    private Long days;
}
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CompareB {
    private String name;

    private Integer age;

    private String createTime;

    private double score;

    private Double totalScore;

    private Date updateTIme;

    private ChildCompare childCompare;

    private Long day;
}
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ChildCompare {
    private String childName;

    private long childAge;
}
@Mapper
public interface CompareConvert {

    CompareConvert INSTANCE = Mappers.getMapper(CompareConvert.class);

    @Mappings({
            @Mapping(source = "days",target = "day"),
            @Mapping(source = "createTime",target = "createTime", dateFormat = "yyyy-MM-dd HH:mm:ss"),
            @Mapping(source = "childCompare",target = "childCompare", mappingControl = DeepClone.class)
    })
    CompareB convert(CompareA compareA);
}

daitianci avatar Jun 24 '22 09:06 daitianci

I think the problem relates to your usage of Lombok. Currently Lombok is not completely supported in this plugin.

hduelme avatar Jun 24 '22 21:06 hduelme

I think the problem relates to your usage of Lombok. Currently Lombok is not completely supported in this plugin.

yes,I user lombok.the version of lombok is 1.18.22

daitianci avatar Jun 26 '22 23:06 daitianci

I think the problem relates to your usage of Lombok. Currently Lombok is not completely supported in this plugin.

I remove lombok,but MapStruct Support 1.3.1 Completion of target and source properties in @Mapping can not work,i think the problem relates to idea version

daitianci avatar Jun 27 '22 00:06 daitianci

Is there any possible solution to this? I'm having the same issue. I tried on both IDEA 2022.1 and 2021.3 with Mapstruct 1.5.3.Final and Lombok 1.18.24. When I Ctrl+left click on the annotation it goes to the declaration properly, but the completion candidates never show up. I've also tried delombok the classes and it does not make difference.

dealexce avatar Oct 23 '22 07:10 dealexce

@dealexce @daitianci the MapStruct version that you are using doesn't make a difference. Are you sure that you have the IntelliJ MapStruct Plugin installed?

filiphr avatar Nov 20 '22 11:11 filiphr

Closing this, since I cannot reproduce it

filiphr avatar May 01 '23 21:05 filiphr