Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

NullPointerException when ignoring target '.' #3238

Copy link
Copy link

Description

@filiphr
Issue body actions

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

Reactions are currently unavailable

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

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.