mapstruct / mapstruct-idea

An IntelliJ IDEA plugin for working with MapStruct
Other
142 stars 38 forks source link

WrongUsageOfMappersFactoryInspection ignores if componentModel is defined in MapperConfig #180

Closed hduelme closed 7 months ago

hduelme commented 8 months ago

Currently the WrongUsageOfMappersFactoryInspection does not check if a @MapperConfig is used to configure the componentModel. Example: Config:

import org.mapstruct.MapperConfig;

@MapperConfig(componentModel = "spring")
public interface MyConfig {
}

Mapper:

import maps.Target;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

@Mapper(config = MyConfig.class)
interface WrongComponentModelMapper {

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

    Target map(Target source);
}

I expect to get a warning, but currently it is ignored.

filiphr commented 8 months ago

Good catch @hduelme