-
Notifications
You must be signed in to change notification settings - Fork 174
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
Use linefeed directly to avoid platform dependent code #454
base: master
Are you sure you want to change the base?
Conversation
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.
Don't mke assumptions about a target.
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.
I don't see a benefit of it ... but can introduce a problems
The benefit is that the code does exactly the same thing and produces the same output on different platforms. This is especially important when writing files since files are not necessarily read on the same platform where they're written. It's also simpler to write \n instead of System.lineSeparator(). Lines are shorter and it's less code to read. |
For example, consider this fragment from JavadocUtiltest:
Here we test different strings depending on which platform the test runs on. We should instead run the same tests on all platforms. |
This plugin seems to have a lot of usage of System.lineSeparator that produces platform dependent output and logs. These days I think pretty much every terminal on every platform should work with a simple \n and when the log goes anywhere other than a terminal then \n works better.