For value mappings a source value can only be mapped once. For example
import org.mapstruct.Mapper;
import org.mapstruct.ValueMapping;
@Mapper
public interface ValueMapper {
enum A {
A,B
}
enum B {
A,B
}
@ValueMapping(source = "A", target = "B")
@ValueMapping(source = "A", target = "A")
A from(B b);
}
is invalide as source A is mapped twice. MapStruct report this as
Source value mapping: "A" cannot be mapped more than once.
Currently the plugin does not recognize this as an error. An inspection should be added for this.
For normal mappings there is already an inspection implemented and could be used as an example: https://github.com/mapstruct/mapstruct-idea/blob/main/src/main/java/org/mapstruct/intellij/inspection/TargetPropertyMappedMoreThanOnceInspection.java.
For value mappings a source value can only be mapped once. For example
is invalide as source
Ais mapped twice. MapStruct report this asCurrently the plugin does not recognize this as an error. An inspection should be added for this.
For normal mappings there is already an inspection implemented and could be used as an example: https://github.com/mapstruct/mapstruct-idea/blob/main/src/main/java/org/mapstruct/intellij/inspection/TargetPropertyMappedMoreThanOnceInspection.java.