This is an automated email from the ASF dual-hosted git repository.

jdaugherty pushed a commit to branch 8.0.x
in repository https://gitbox.apache.org/repos/asf/grails-core.git


The following commit(s) were added to refs/heads/8.0.x by this push:
     new 8f39bb74f2 Fix normalization script
8f39bb74f2 is described below

commit 8f39bb74f219405cc59c37750216423096127145
Author: James Daugherty <[email protected]>
AuthorDate: Sat Jul 11 12:35:32 2026 -0400

    Fix normalization script
---
 etc/bin/normalize-annotations.groovy | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/etc/bin/normalize-annotations.groovy 
b/etc/bin/normalize-annotations.groovy
index ac777c3b7b..cd052dca18 100755
--- a/etc/bin/normalize-annotations.groovy
+++ b/etc/bin/normalize-annotations.groovy
@@ -135,13 +135,18 @@ if (!args) {
 }
 
 args.each { dir ->
-    Files.walk(Paths.get(dir)).withCloseable { stream ->
-        stream.filter { it.toString().endsWith('.java') && 
Files.isRegularFile(it) }.each { Path path ->
+    // try/finally instead of withCloseable: Stream is AutoCloseable, not 
Closeable,
+    // and older Groovy runtimes lack withCloseable(AutoCloseable)
+    def stream = Files.walk(Paths.get(dir))
+    try {
+        stream.filter { it.toString().endsWith('.java') && 
Files.isRegularFile(it) }.forEach { Path path ->
             String original = new String(Files.readAllBytes(path), 'UTF-8')
             String normalized = normalize(original)
             if (normalized != original) {
                 Files.write(path, normalized.getBytes('UTF-8'))
             }
         }
+    } finally {
+        stream.close()
     }
 }

Reply via email to