From 53528dd603a6083a9d49eb8673c6a8056b350ffc Mon Sep 17 00:00:00 2001 From: Eric Milles Date: Tue, 13 May 2025 15:52:10 -0500 Subject: [PATCH] GROOVY-11658: `groovyc`: log command-line arguments at verbose level --- .../main/java/org/codehaus/groovy/ant/Groovyc.java | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovyc.java b/subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovyc.java index 37fdc4aaa09..c891d4db906 100644 --- a/subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovyc.java +++ b/subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovyc.java @@ -48,7 +48,6 @@ import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; -import java.io.Writer; import java.net.URI; import java.net.URISyntaxException; import java.nio.charset.Charset; @@ -1255,7 +1254,7 @@ private PrintWriter printWriter(File tempFile) throws IOException { private String[] makeCommandLine(List commandLineList) { String[] commandLine = commandLineList.toArray(String[]::new); - log.info("Compilation arguments:\n" + String.join("\n", commandLine)); + log.verbose("Compilation arguments:\n" + String.join("\n", commandLine)); // GROOVY-11658 return commandLine; } @@ -1313,9 +1312,9 @@ private void runCompiler(String[] commandLine) { // unwrap to the real exception t = e.getCause(); } - Writer writer = new StringBuilderWriter(); + var writer = new StringBuilderWriter(); new ErrorReporter(t, false).write(new PrintWriter(writer)); - String message = writer.toString(); + log.error(writer.toString()); taskSuccess = false; if (errorProperty != null) { @@ -1323,10 +1322,7 @@ private void runCompiler(String[] commandLine) { } if (failOnError) { - log.error(message); throw new BuildException("Compilation Failed", t, getLocation()); - } else { - log.error(message); } } } @@ -1409,7 +1405,7 @@ protected GroovyClassLoader buildClassLoaderFor() { ClassLoader loader = getClass().getClassLoader(); if (loader instanceof AntClassLoader) { - AntClassLoader antLoader = (AntClassLoader) loader; + @SuppressWarnings("resource") AntClassLoader antLoader = (AntClassLoader) loader; String[] pathElm = antLoader.getClasspath().split(File.pathSeparator, -1); List classpath = configuration.getClasspath(); /*