Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8311239

GC: Remove trailing blank lines in source files

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Fixed
    • P4
    • 22
    • 22
    • hotspot
    • gc
    • b07

    Description

      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 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

      Attachments

        Issue Links

          Activity

            People

              lkorinth Leo Korinth
              lkorinth Leo Korinth
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: