Skip to content

Incorrect "unmapped property" warning with inheritance #35

@jacobhampel

Description

@jacobhampel

We have some internal messages which extend a BaseClass. This BaseClass contains some variables for our database. These variables should be present in our DTOs.
To avoid ignoring the variables in every single mapper we're using a GenericConfig. In the GenericConfig no warnings were displayed. Neither when we compile the code nor at the IDE level.
Our GenericConfig looks like the following:

@MapperConfig(uses = DateToOffsetDateMapper.class,
        unmappedTargetPolicy = ReportingPolicy.ERROR,
        mappingInheritanceStrategy = MappingInheritanceStrategy.AUTO_INHERIT_FROM_CONFIG)
public interface GenericConfig {

    @Mapping(target = "storageId", ignore = true)
    @Mapping(target = "date", ignore = true)
    BaseClass genericMessageMapping(GenericDto dto); 
}

The GenericDto is an empty interface. All DTOs implements this interface.

The BaseClass looks like the following:

public class BaseClass
{
   private String storageId;
   private OffsetDateTime date;

   //getter and setter
}

Every mapper extends this config.

@Mapper(config = GenericConfig.class, uses = {})
public interface CarMapper  {
   Car map(CarDto dto);
}

In this example Car extends BaseClass and CarDto extends GenericDto.
Now my question: Why does the IDEA plugin shows me the error that I have unmapped properties at Car map(CarDto dto)?
If I compile the code no warnings are shown, which I think is correct.

Maybe you have an idea where I have to look.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions