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

NullPointerException when ignoring target '.' #3238

Closed
filiphr opened this issue Apr 16, 2023 · 0 comments · Fixed by #3259
Closed

NullPointerException when ignoring target '.' #3238

filiphr opened this issue Apr 16, 2023 · 0 comments · Fixed by #3259
Labels
Milestone

Comments

@filiphr
Copy link
Member

filiphr commented Apr 16, 2023

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

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