Skip to content

NullPointerException when ignoring target '.' #3238

@filiphr

Description

@filiphr

Expected behavior

Not to have a NullPointerException. The expectation would also be that ignoring target this ('.') should not be possible. It should instead be done with @BeanMapping(ignoreByDefault = true)

Actual behavior

NullPointerException is thrown, which leads to an internal error in the processor.

Steps to reproduce the problem

One example is available in #3192

Another more minimal example is:

@Mapper
public interface TestMapper {

    @Mapping(target = ".", ignore = true)
    Target map(Source source);

    class Target {

        private final String value;

        public Target(String value) {
            this.value = value;
        }

        public String getValue() {
            return value;
        }
    }

    class Source {

        private final String value;

        public Target(String value) {
            this.value = value;
        }

        public String getValue() {
            return value;
        }
    }
}

MapStruct Version

1.5.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions