Empty new line at the end of the Java source files

前端 未结 9 731
春和景丽
春和景丽 2021-02-01 00:44

In my current project, we always insert an empty new line at the end of the Java source files. We also enforce this with CheckStyle (with error level).

I was searching fo

9条回答
  •  故里飘歌
    2021-02-01 01:23

    Have a look at this SO question..

    The answer shamelessly stolen from Ralph Rickenbach:

    Many older tools misbehave if the last line of data in a text file is not terminated with a newline or carriage return / new line combination. They ignore that line as it is terminated with ^Z (eof) instead.

    So I figure it's mostly a ghost of the past. Unfortunately, such ghosts can bite you in the tail if you don't properly exorcise them. (Is your build server old and uses older shell scripts for summaries and such things).

提交回复
热议问题