RFR: 8311239: GC: Remove trailing blank lines in source files

Leo Korinth lkorinth at openjdk.org
Mon Jul 3 12:11:05 UTC 2023


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

-------------

Commit messages:
 - 8311239: GC: Remove trailing blank lines in source files

Changes: https://git.openjdk.org/jdk/pull/14753/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14753&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8311239
  Stats: 213 lines in 210 files changed: 0 ins; 213 del; 0 mod
  Patch: https://git.openjdk.org/jdk/pull/14753.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/14753/head:pull/14753

PR: https://git.openjdk.org/jdk/pull/14753


More information about the hotspot-gc-dev mailing list