-
Enhancement
-
Resolution: Won't Fix
-
P4
-
9
Recently, a change has introduced a file without a newline character at the end of the file. This is not only considered bad style but is also rejected by some compilers with a warning or even an error.
A discussion on the hotspot-dev mailing list (http://mail.openjdk.java.net/pipermail/hotspot-dev/2015-February/thread.html#17119) has shown that it would be nice if we could enforce that every file ends with exactly one newline (much like we enforce that we don't check in files which contain lines with trailing whitespace.
A quick test with the command line:
find -iregex '.*\.\(java\|txt\|c\|cc\|h\|hpp\|cpp\)$' | xargs perl -0777 -ne 'print "Must have exactly one trailing newline: $ARGV\n" unless m~[^\n]\Z~s'
(suggested by Martin Buchholz) revealed that the hotspot repository currently contains a lot of files
with more than one newline at the end of file (it's three in ./agent, 133 in ./test and 77 in ./src). So before we can enable a new jcheck rule which enforces "exactly one newline at the end of file" we will first have to clean up these files.
The corresponding jcheck enhancement is tracked under "CODETOOLS-7901298: jcheck should check that every file ends with exactly one newline" (https://bugs.openjdk.java.net/browse/JDK-8072935).
A discussion on the hotspot-dev mailing list (http://mail.openjdk.java.net/pipermail/hotspot-dev/2015-February/thread.html#17119) has shown that it would be nice if we could enforce that every file ends with exactly one newline (much like we enforce that we don't check in files which contain lines with trailing whitespace.
A quick test with the command line:
find -iregex '.*\.\(java\|txt\|c\|cc\|h\|hpp\|cpp\)$' | xargs perl -0777 -ne 'print "Must have exactly one trailing newline: $ARGV\n" unless m~[^\n]\Z~s'
(suggested by Martin Buchholz) revealed that the hotspot repository currently contains a lot of files
with more than one newline at the end of file (it's three in ./agent, 133 in ./test and 77 in ./src). So before we can enable a new jcheck rule which enforces "exactly one newline at the end of file" we will first have to clean up these files.
The corresponding jcheck enhancement is tracked under "CODETOOLS-7901298: jcheck should check that every file ends with exactly one newline" (https://bugs.openjdk.java.net/browse/JDK-8072935).
- relates to
-
CODETOOLS-7901298 jcheck should check that every file ends with exactly one newline
-
- New
-