Skip to content

Conversation

@izeye
Copy link
Contributor

@izeye izeye commented Jul 16, 2018

This PR changes to use system-dependent line separator in TypeUtils.getJavaDoc().

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jul 16, 2018
@izeye
Copy link
Contributor Author

izeye commented Jul 16, 2018

On a second thought both line feed ('\n') and carriage return ('\r') should be removed, not system-dependent line separator. I'll update shortly.

@izeye izeye force-pushed the type-utils-line-separator branch from dd56e22 to f1997cf Compare July 16, 2018 05:46
@izeye izeye changed the title Use system-dependent line separator in TypeUtils.getJavaDoc() Remove carriage returns in TypeUtils.getJavaDoc() Jul 16, 2018
@izeye
Copy link
Contributor Author

izeye commented Jul 16, 2018

I've updated to remove carriage returns in addition to line feeds.

Copy link
Member

@snicoll snicoll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again for the PR! I've added a couple of comments

if (javadoc != null) {
javadoc = javadoc.replaceAll("\\n", "");
javadoc = javadoc.trim();
javadoc = javadoc.replaceAll("[\r\n]+", "").trim();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we do two passes instead (\r\n then \n)? Technically speaking that would replace \r

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@snicoll I thought removing "\r" in Javadoc, especially as description for application properties is safe. Am I missing something?

? this.env.getElementUtils().getDocComment(element) : null);
if (javadoc != null) {
javadoc = javadoc.replaceAll("\\n", "");
javadoc = javadoc.trim();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still would like surrounding spaces to be removed. Do you disagree with that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@snicoll No, I just collapsed the two statements into one. I thought it's less verbose than before.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I missed that 😓

@snicoll snicoll self-assigned this Jul 16, 2018
@snicoll snicoll added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Jul 16, 2018
@snicoll snicoll added this to the 1.5.15 milestone Jul 16, 2018
snicoll added a commit that referenced this pull request Jul 16, 2018
* pr/13779:
  Remove carriage returns in TypeUtils.getJavaDoc()
@snicoll snicoll closed this in 9fba2c4 Jul 16, 2018
@snicoll
Copy link
Member

snicoll commented Jul 16, 2018

Thanks a lot for the feedback @izeye

@izeye izeye deleted the type-utils-line-separator branch July 16, 2018 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: enhancement A general enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants