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

Report the specific type for which a nested target property has no write accessor or not exists #1185

Closed
filiphr opened this Issue Apr 23, 2017 · 0 comments

Comments

Projects
None yet
1 participant
@filiphr
Member

filiphr commented Apr 23, 2017

With #1184 the reporting of the error is moved into the TargetReference. The error reporting stays the same and the entire target name is reported.

For a Mapping like:

@Mappings( {
    @Mapping( target = "readOnly", source = "sourceRead"),
    @Mapping( target = "writable2", source = "writable"),
    @Mapping( target = "nestedTarget.readOnly", source = "nestedSource.nested"),
    @Mapping( target = "nestedTarget.writable2", source = "nestedSource.writable"),
} )
Target map(Source source);

The error messages look like:

  • Property "readOnly" has no write accessor.
  • Unknown property "writable2" in return type..
  • Property "nestedTarget.readOnly" has no write accessor.
  • Unknown property "nestedTarget.writable2" in return type..

It would be much better if MapStruct reports that like:

  • Property "readOnly" has no write accessor in "com.example.Target".
  • Unknown property "writable2" in "com.example.Target".
  • Property "readOnly" has no write accessor in "com.example.NestedTarget".
  • Unknown property "writable2" in "com.example.NestedTarget".

For a discussion: Do we want to keep the same error messages if there are no nested target mappings, or it is still better to display the return type in the error message?

@filiphr filiphr added the enhancement label Apr 23, 2017

@filiphr filiphr added this to the 1.2.0.CR1 milestone Apr 23, 2017

filiphr added a commit to filiphr/mapstruct that referenced this issue Jun 28, 2017

@filiphr filiphr self-assigned this Jun 28, 2017

filiphr added a commit to filiphr/mapstruct that referenced this issue Jun 29, 2017

filiphr added a commit to filiphr/mapstruct that referenced this issue Jun 29, 2017

@filiphr filiphr closed this in #1234 Jun 29, 2017

filiphr added a commit that referenced this issue Jun 29, 2017

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