RFR: 8311239: GC: Remove trailing blank lines in source files
Hamlin Li
mli at openjdk.org
Fri Jul 7 07:28:54 UTC 2023
On Mon, 3 Jul 2023 12:03:08 GMT, Leo Korinth <lkorinth at openjdk.org> wrote:
> Remove trailing "blank" lines in source files.
>
> I like to use global-whitespace-cleanup-mode, but I can not use it if the files are "dirty" to begin with. This fix will make more files "clean". I also considered adding a check for this in jcheck for skara, however it seems jcheck code handling hunks does not track end-of-files.
>
> The fix removes trailing lines matching ^[[:space:]]*$ in gc owned files.
>
> I have applied the following bash script to each file:
>
> `find test/hotspot/jtreg/gc test/hotspot/jtreg/vmTestbase/gc src/hotspot/share/gc -type f | xargs -n 1 clean-script`
>
>
> #!/usr/bin/env bash
> # clean-script
> set -eu -o pipefail
> [[ -v TRACE ]] && set -o xtrace
>
> file="$1"
> mime=$(file --brief --mime-type "$file")
> if [[ ! "$mime" =~ text/.* ]]; then
> echo "excluding file: $file with mime: $mime";
> exit 0;
> fi
>
> while [[ $(tail -n 1 "$file") =~ ^[[:space:]]*$ ]]; do
> truncate -s -1 "$file"
> done
>
> The only non text file in the gc folders was: testcases.jar
> and "[JDK-8311240](https://bugs.openjdk.org/browse/JDK-8311240) Create testcases.jar from test case" was filed
>
> `git diff --ignore-space-change --ignore-blank-lines master` displays no changes
> `git diff --ignore-blank-lines master` displays no changes
Marked as reviewed by mli (Reviewer).
-------------
PR Review: https://git.openjdk.org/jdk/pull/14753#pullrequestreview-1518148704
More information about the hotspot-gc-dev
mailing list