-
-
Notifications
You must be signed in to change notification settings - Fork 1k
#2987 Support for defining Javadoc in the generated mapper implementation #3219
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
#2987 Support for defining Javadoc in the generated mapper implementation #3219
Conversation
filiphr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks really good @jccampanero. Thanks a lot for your work on this and sorry that it took me so long to review it.
I've left some comments that I think we should address before we merge this to main.
In addition to the comments. It would perhaps be good to add something in the documentation for this and to also add something in the javadoc of @Mapper, perhaps a @see.
What do you think @jccampanero
processor/src/main/java/org/mapstruct/ap/internal/model/Javadoc.java
Outdated
Show resolved
Hide resolved
processor/src/main/resources/org/mapstruct/ap/internal/model/GeneratedType.ftl
Outdated
Show resolved
Hide resolved
processor/src/main/resources/org/mapstruct/ap/internal/model/Javadoc.ftl
Outdated
Show resolved
Hide resolved
processor/src/main/resources/org/mapstruct/ap/internal/model/Javadoc.ftl
Outdated
Show resolved
Hide resolved
processor/src/main/resources/org/mapstruct/ap/internal/model/Javadoc.ftl
Outdated
Show resolved
Hide resolved
processor/src/test/java/org/mapstruct/ap/test/javadoc/JavadocTest.java
Outdated
Show resolved
Hide resolved
processor/src/main/java/org/mapstruct/ap/internal/processor/MapperCreationProcessor.java
Show resolved
Hide resolved
processor/src/main/java/org/mapstruct/ap/internal/model/Mapper.java
Outdated
Show resolved
Hide resolved
Thank you very much @filiphr. There is no need to apologize; on the contrary, I am sorry for the time in providing a pull request. In addition, thank you very much for your time and for reviewing the code. I have been working in the changes you proposed: only the tests are still pending, and probably improving the Javadoc comments of the Of course, I agree with you: I will include a reference to the new functionality in the Javadoc comments of |
|
Nice feature 👍 |
filiphr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comments in the Javadoc look good to me.
I've left one small comment for the printing of the error message if something is missing. You could also add an erroneous test for that as well.
For the documentation, I think that we can add an additional section to chapter-3-defining-a-mapper.asciidoc below the "Adding annotations" section, i.e. at the end.
processor/src/main/java/org/mapstruct/ap/internal/processor/MapperCreationProcessor.java
Outdated
Show resolved
Hide resolved
Fix reported error line number, changed after license text inclusion.
|
Thanks for the changes @jccampanero. I've pushed one small polishing commit for the tests. Can you please add some docs and then we can merge this? |
|
Thank you very much for the changes performed in the tests @filiphr. Of course, I will update the documentation to include the Can I update |
I forgot about this. Yes please go ahead and update that test to use fixtures. |
|
Thank you very much @filiphr. Yes, sorry, I have been busy the last week. |
No need to apologise @jccampanero. We are all doing this in our free time, as you can see I am also not the most free person as well 😄 |
filiphr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only one small typo in the docs
documentation/src/main/asciidoc/chapter-3-defining-a-mapper.asciidoc
Outdated
Show resolved
Hide resolved
|
I implemented the required changes, the one related to the documentation and the other one related to the use of fixtures in the tests. @filiphr, please, consider review carefully the fixtures provided: I think they are right but I was unable to run the tests in IntelliJ, for any reason the Should we create additional test cases? |
Thank you very much always for your kindness @filiphr, I really appreciate it. |
…ciidoc Co-authored-by: Filip Hrisafov <[email protected]>
|
@filiphr I would like to perform an additional change before closing the PR if you consider it appropriate. The generated Javadoc comments always start right straight the new line character, no matter how I configure the FreeMarker template. I mean, it generates: but I think this should be: Note the space before the asterisk. Please, can you advice me about how I should modify the FreeMarker template to deal with that situation? Thank you in advance. |
After reviewing the code I think the issue could be motivated by If I'm right, I think it's preferable to use the current implementation of the code, as it generates correct Javadoc comments, which is ultimately the only important thing in this case, to avoid changing the current functionality implemented for the rest of the templates. |
You are right @jccampanero. The |
|
This has been integrated. Thanks @jccampanero |
|
You are welcome, and thank you for your support @filiphr. Let's tackle the next issue!! |
The proposed change provides a new annotation allowing the definition of Javadoc comments in the generated
Mapperimplementation.For instance, the following definition:
will generate something like:
The annotation allows users to write Text blocks:
or plain old Java
Strings:Fixes #2987.