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

Incorrect "unmapped property" warning with inheritance #35

Open
jacobhampel opened this issue Aug 1, 2019 · 2 comments
Open

Incorrect "unmapped property" warning with inheritance #35

jacobhampel opened this issue Aug 1, 2019 · 2 comments

Comments

@jacobhampel
Copy link

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.

@filiphr
Copy link
Member

filiphr commented Aug 2, 2019

Currently we are not looking into the Mapper#config nor we apply inheritance for the mapping policies.

Edit: I didn't see that this issue is inthe correct place

@filiphr
Copy link
Member

filiphr commented Aug 2, 2019

@jacobhampel if you are interested in adding this functionality to the plugin I can help you out

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

No branches or pull requests

2 participants