Skip to content

Wrong type for nested properties #931

@oliversaggau

Description

@oliversaggau

When I try to map a nested property from source (long) to the target (Long) and the source or the nested object is null, the target gets the value 0L instead of null. I think the type of generated method in the impl is wrong. Instead of using the type of the target (Long) which actually is nullable, MapStruct uses the type of the source property (long) for the generated method.

I attached a simple model and a unit-test which covers this issue:
src.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions