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

emilles pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git


The following commit(s) were added to refs/heads/master by this push:
     new 6fd3b7ea17 GROOVY-11573: propagate parameters configuration to java 
compiler
6fd3b7ea17 is described below

commit 6fd3b7ea17cdf58005e39bbc21f25550e729bc41
Author: Eric Milles <[email protected]>
AuthorDate: Sun Feb 23 14:52:40 2025 -0600

    GROOVY-11573: propagate parameters configuration to java compiler
---
 .../codehaus/groovy/tools/FileSystemCompiler.java  |  18 ++-
 .../org/codehaus/groovy/ant/GroovycTest.xml        | 117 +++++++----------
 .../org/codehaus/groovy/ant/GroovycTest2.java      |  15 +--
 ...oovycTest2.java => ParameterMetadataCheck.java} |  15 +--
 .../org/codehaus/groovy/ant/params.groovy          |   1 +
 .../org/codehaus/groovy/ant/GroovycTest.java       | 142 +++++++++++----------
 6 files changed, 148 insertions(+), 160 deletions(-)

diff --git a/src/main/java/org/codehaus/groovy/tools/FileSystemCompiler.java 
b/src/main/java/org/codehaus/groovy/tools/FileSystemCompiler.java
index 54d313d3aa..cb4d35cd40 100644
--- a/src/main/java/org/codehaus/groovy/tools/FileSystemCompiler.java
+++ b/src/main/java/org/codehaus/groovy/tools/FileSystemCompiler.java
@@ -23,6 +23,7 @@ import org.codehaus.groovy.control.CompilationUnit;
 import org.codehaus.groovy.control.CompilerConfiguration;
 import org.codehaus.groovy.control.ConfigurationException;
 import org.codehaus.groovy.control.messages.WarningMessage;
+import org.codehaus.groovy.runtime.ArrayGroovyMethods;
 import org.codehaus.groovy.runtime.DefaultGroovyStaticMethods;
 import org.codehaus.groovy.runtime.StringGroovyMethods;
 import org.codehaus.groovy.tools.javac.JavaAwareCompilationUnit;
@@ -421,7 +422,7 @@ public class FileSystemCompiler {
                 configuration.setClasspath(classpath);
             }
 
-            if (targetDir != null && targetDir.getName().length() > 0) {
+            if (targetDir != null && !targetDir.getName().isEmpty()) {
                 configuration.setTargetDirectory(targetDir);
             }
 
@@ -451,12 +452,12 @@ public class FileSystemCompiler {
                     compilerOptions.put("stubDir", stubDirectory);
                 }
                 if (keepStubs) {
-                    compilerOptions.put("keepStubs", true);
+                    compilerOptions.put("keepStubs", Boolean.TRUE);
                 }
                 configuration.setJointCompilationOptions(compilerOptions);
             }
 
-            final List<String> transformations = new ArrayList<>();
+            List<String> transformations = new ArrayList<>();
             if (compileStatic) {
                 transformations.add("ast(groovy.transform.CompileStatic)");
             }
@@ -477,6 +478,15 @@ public class FileSystemCompiler {
                     scripts.addAll(StringGroovyMethods.tokenize(configScripts, 
','));
                 }
                 processConfigScripts(scripts, configuration);
+                // GROOVY-11573: propagate parameters configuration
+                if (jointCompilation && configuration.getParameters()) {
+                    Map<String, Object> options = 
configuration.getJointCompilationOptions();
+                    String[] flags = (String[]) options.getOrDefault("flags", 
new String[0]);
+                    if (!ArrayGroovyMethods.contains(flags, "parameters")) {
+                        flags = ArrayGroovyMethods.plus(flags, "parameters");
+                        options.put("flags", flags);
+                    }
+                }
             }
 
             return configuration;
@@ -508,7 +518,7 @@ public class FileSystemCompiler {
             if (previewFeatures) {
                 result.add("-enable-preview");
             }
-            return result.isEmpty() ? null : result.toArray(new String[0]);
+            return result.isEmpty() ? null : result.toArray(String[]::new);
         }
     }
 }
diff --git 
a/subprojects/groovy-ant/src/test-resources/org/codehaus/groovy/ant/GroovycTest.xml
 
b/subprojects/groovy-ant/src/test-resources/org/codehaus/groovy/ant/GroovycTest.xml
index 0f27303941..bb3695b1af 100644
--- 
a/subprojects/groovy-ant/src/test-resources/org/codehaus/groovy/ant/GroovycTest.xml
+++ 
b/subprojects/groovy-ant/src/test-resources/org/codehaus/groovy/ant/GroovycTest.xml
@@ -20,12 +20,10 @@
 
 -->
 
-<project name="Test Groovyc Task" default="test1">
+<project name="Test Groovyc Task">
 
-    <property name="srcPath" value="."/>
-    <property name="destPath" value="${user.dir}/build/classes/groovy/test"/>
-
-    <property name="javaVersion" value="8"/>
+    <property name="srcPath" location="."/>
+    <property name="destPath" 
location="${user.dir}/build/classes/groovy/test"/>
 
     <path id="groovyMaterials">
         <pathelement path="${java.class.path}"/>
@@ -33,187 +31,170 @@
 
     <taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc" 
classpathref="groovyMaterials"/>
 
+    <presetdef name="compile-plain">
+        <groovyc srcdir="${srcPath}" destdir="${destPath}"/>
+    </presetdef>
+
+    <presetdef name="compile-joint">
+        <groovyc srcdir="${srcPath}" destdir="${destPath}">
+            <javac debug="true" release="8"/>
+        </groovyc>
+    </presetdef>
+
+
     <target name="GroovycTest1_NoFork_NoClasspath">
-        <groovyc srcdir="${srcPath}" destdir="${destPath}" 
includes="GroovycTest1.groovy"/>
+        <compile-plain includes="GroovycTest1.groovy"/>
         <java classname="org.codehaus.groovy.ant.GroovycTest1"/>
     </target>
 
     <target name="GroovycTest1_NoFork_WithGroovyClasspath">
-        <groovyc srcdir="${srcPath}" destdir="${destPath}" 
includes="GroovycTest1.groovy"
-                 classpathref="groovyMaterials"/>
+        <compile-plain includes="GroovycTest1.groovy" 
classpathref="groovyMaterials"/>
         <java classname="org.codehaus.groovy.ant.GroovycTest1"/>
     </target>
 
     <target name="GroovycTest1_NoFork_WithJavaClasspath">
-        <groovyc srcdir="${srcPath}" destdir="${destPath}" 
includes="GroovycTest1.groovy"/>
+        <compile-plain includes="GroovycTest1.groovy"/>
         <java classname="org.codehaus.groovy.ant.GroovycTest1" 
classpathref="groovyMaterials"/>
     </target>
 
     <target name="GroovycTest1_NoFork_WithBothClasspath">
-        <groovyc srcdir="${srcPath}" destdir="${destPath}" 
includes="GroovycTest1.groovy"
-                 classpathref="groovyMaterials"/>
+        <compile-plain includes="GroovycTest1.groovy" 
classpathref="groovyMaterials"/>
         <java classname="org.codehaus.groovy.ant.GroovycTest1" 
classpathref="groovyMaterials"/>
     </target>
 
     <target name="GroovycTest1_ForkGroovy_NoClasspath">
-        <groovyc srcdir="${srcPath}" destdir="${destPath}" 
includes="GroovycTest1.groovy" fork="true"/>
+        <compile-plain includes="GroovycTest1.groovy" fork="true"/>
         <java classname="org.codehaus.groovy.ant.GroovycTest1"/>
     </target>
 
     <target name="GroovycTest1_ForkGroovy_WithGroovyClasspath">
-        <groovyc srcdir="${srcPath}" destdir="${destPath}" 
includes="GroovycTest1.groovy" classpathref="groovyMaterials"
-                 fork="true"/>
+        <compile-plain includes="GroovycTest1.groovy" 
classpathref="groovyMaterials" fork="true"/>
         <java classname="org.codehaus.groovy.ant.GroovycTest1"/>
     </target>
 
     <target name="GroovycTest1_ForkGroovy_WithJavaClasspath">
-        <groovyc srcdir="${srcPath}" destdir="${destPath}" 
includes="GroovycTest1.groovy" fork="true"/>
+        <compile-plain includes="GroovycTest1.groovy" fork="true"/>
         <java classname="org.codehaus.groovy.ant.GroovycTest1" 
classpathref="groovyMaterials"/>
     </target>
 
     <target name="GroovycTest1_ForkGroovy_WithBothClasspath">
-        <groovyc srcdir="${srcPath}" destdir="${destPath}" 
includes="GroovycTest1.groovy" classpathref="groovyMaterials"
-                 fork="true"/>
+        <compile-plain includes="GroovycTest1.groovy" 
classpathref="groovyMaterials" fork="true"/>
         <java classname="org.codehaus.groovy.ant.GroovycTest1" 
classpathref="groovyMaterials"/>
     </target>
 
     <target name="GroovycTest1_Joint_NoFork_NoClasspath">
-        <groovyc srcdir="${srcPath}" destdir="${destPath}" 
includes="GroovycTest1.groovy,GroovyTest2.java">
-            <javac source="${javaVersion}" target="${javaVersion}" 
debug="true"/>
-        </groovyc>
+        <compile-joint includes="GroovycTest1.groovy,GroovyTest2.java"/>
         <java classname="org.codehaus.groovy.ant.GroovycTest1"/>
         <java classname="org.codehaus.groovy.ant.GroovycTest2"/>
     </target>
 
     <target name="GroovycTest1_Joint_NoFork_WithGroovyClasspath">
-        <groovyc srcdir="${srcPath}" destdir="${destPath}" 
includes="GroovycTest1.groovy,GroovycTest2.java"
-                 classpathref="groovyMaterials">
-            <javac source="${javaVersion}" target="${javaVersion}" 
debug="true"/>
-        </groovyc>
+        <compile-joint includes="GroovycTest1.groovy,GroovycTest2.java" 
classpathref="groovyMaterials"/>
         <java classname="org.codehaus.groovy.ant.GroovycTest1"/>
         <java classname="org.codehaus.groovy.ant.GroovycTest2"/>
     </target>
 
     <target name="Groovyc_Joint_NoFork_NestedCompilerArg_WithGroovyClasspath">
-        <groovyc srcdir="${srcPath}" destdir="${destPath}" 
includes="IncorrectGenericsUsage.java"
-                 classpathref="groovyMaterials">
-            <javac source="${javaVersion}" target="${javaVersion}" 
debug="true">
+        <compile-joint includes="IncorrectGenericsUsage.java" 
classpathref="groovyMaterials">
+            <javac>
                 <compilerarg value="-Xlint"/>
             </javac>
-        </groovyc>
+        </compile-joint>
     </target>
 
     <target name="GroovycTest1_Joint_NoFork_WithJavaClasspath">
-        <groovyc srcdir="${srcPath}" destdir="${destPath}" 
includes="GroovycTest1.groovy,GroovycTest2.java">
-            <javac source="${javaVersion}" target="${javaVersion}" 
debug="true"/>
-        </groovyc>
+        <compile-joint includes="GroovycTest1.groovy,GroovycTest2.java"/>
         <java classname="org.codehaus.groovy.ant.GroovycTest1" 
classpathref="groovyMaterials"/>
         <java classname="org.codehaus.groovy.ant.GroovycTest2" 
classpathref="groovyMaterials"/>
     </target>
 
     <target name="GroovycTest1_Joint_NoFork_WithBothClasspath">
-        <groovyc srcdir="${srcPath}" destdir="${destPath}" 
includes="GroovycTest1.groovy,GroovycTest2.java"
-                 classpathref="groovyMaterials">
-            <javac source="${javaVersion}" target="${javaVersion}" 
debug="true"/>
-        </groovyc>
+        <compile-joint includes="GroovycTest1.groovy,GroovycTest2.java" 
classpathref="groovyMaterials"/>
         <java classname="org.codehaus.groovy.ant.GroovycTest1" 
classpathref="groovyMaterials"/>
         <java classname="org.codehaus.groovy.ant.GroovycTest2" 
classpathref="groovyMaterials"/>
     </target>
 
     <target name="GroovycTest1_Joint_ForkGroovy_NoClasspath">
-        <groovyc srcdir="${srcPath}" destdir="${destPath}" 
includes="GroovycTest1.groovy,GroovycTest2.java" fork="true">
-            <javac source="${javaVersion}" target="${javaVersion}" 
debug="true"/>
-        </groovyc>
+        <compile-joint includes="GroovycTest1.groovy,GroovycTest2.java" 
fork="true"/>
         <java classname="org.codehaus.groovy.ant.GroovycTest1"/>
         <java classname="org.codehaus.groovy.ant.GroovycTest2"/>
     </target>
 
     <target name="GroovycTest1_Joint_ForkGroovy_WithGroovyClasspath">
-        <groovyc srcdir="${srcPath}" destdir="${destPath}" 
includes="GroovycTest1.groovy,GroovycTest2.java" fork="true"
-                 classpathref="groovyMaterials">
-            <javac source="${javaVersion}" target="${javaVersion}" 
debug="true"/>
-        </groovyc>
+        <compile-joint includes="GroovycTest1.groovy,GroovycTest2.java" 
fork="true" classpathref="groovyMaterials"/>
         <java classname="org.codehaus.groovy.ant.GroovycTest1"/>
         <java classname="org.codehaus.groovy.ant.GroovycTest2"/>
     </target>
 
     <target name="GroovycTest1_Joint_ForkGroovy_WithJavaClasspath">
-        <groovyc srcdir="${srcPath}" destdir="${destPath}" 
includes="GroovycTest1.groovy,GroovycTest2.java" fork="true">
-            <javac source="${javaVersion}" target="${javaVersion}" 
debug="true"/>
-        </groovyc>
+        <compile-joint includes="GroovycTest1.groovy,GroovycTest2.java" 
fork="true"/>
         <java classname="org.codehaus.groovy.ant.GroovycTest1" 
classpathref="groovyMaterials"/>
         <java classname="org.codehaus.groovy.ant.GroovycTest2" 
classpathref="groovyMaterials"/>
     </target>
 
     <target name="GroovycTest1_Joint_ForkGroovy_WithBothClasspath">
-        <groovyc srcdir="${srcPath}" destdir="${destPath}" 
includes="GroovycTest1.groovy,GroovycTest2.java" fork="true"
-                 classpathref="groovyMaterials">
-            <javac source="${javaVersion}" target="${javaVersion}" 
debug="true"/>
-        </groovyc>
+        <compile-joint includes="GroovycTest1.groovy,GroovycTest2.java" 
fork="true" classpathref="groovyMaterials"/>
         <java classname="org.codehaus.groovy.ant.GroovycTest1" 
classpathref="groovyMaterials"/>
         <java classname="org.codehaus.groovy.ant.GroovycTest2" 
classpathref="groovyMaterials"/>
     </target>
 
     <target name="GroovycTest1_ForkGroovy_NoClasspath_WithJavaHome">
-        <groovyc srcdir="${srcPath}" destdir="${destPath}" 
includes="GroovycTest1.groovy" fork="true"
-                 javahome="${alt.java.home}"/>
+        <compile-plain includes="GroovycTest1.groovy" fork="true" 
javahome="${alt.java.home}"/>
         <java classname="org.codehaus.groovy.ant.GroovycTest1"/>
     </target>
 
     <target name="GroovycTest1_ForkGroovy_WithGroovyClasspath_WithJavaHome">
-        <groovyc srcdir="${srcPath}" destdir="${destPath}" 
includes="GroovycTest1.groovy" classpathref="groovyMaterials"
-                 fork="true" javahome="${alt.java.home}"/>
+        <compile-plain includes="GroovycTest1.groovy" 
classpathref="groovyMaterials" fork="true" javahome="${alt.java.home}"/>
         <java classname="org.codehaus.groovy.ant.GroovycTest1"/>
     </target>
 
     <target name="GroovycTest1_ForkGroovy_WithJavaClasspath_WithJavaHome">
-        <groovyc srcdir="${srcPath}" destdir="${destPath}" 
includes="GroovycTest1.groovy" fork="true"
-                 javahome="${alt.java.home}"/>
+        <compile-plain includes="GroovycTest1.groovy" fork="true" 
javahome="${alt.java.home}"/>
         <java classname="org.codehaus.groovy.ant.GroovycTest1" 
classpathref="groovyMaterials"/>
     </target>
 
     <target name="GroovycTest1_ForkGroovy_WithBothClasspath_WithJavaHome">
-        <groovyc srcdir="${srcPath}" destdir="${destPath}" 
includes="GroovycTest1.groovy" classpathref="groovyMaterials"
-                 fork="true" javahome="${alt.java.home}"/>
+        <compile-plain includes="GroovycTest1.groovy" 
classpathref="groovyMaterials" fork="true" javahome="${alt.java.home}"/>
         <java classname="org.codehaus.groovy.ant.GroovycTest1" 
classpathref="groovyMaterials"/>
     </target>
 
     <target name="GroovycTest1_ForkGroovy_NoClasspath_Fail">
-        <groovyc srcdir="${srcPath}" destdir="${destPath}" 
includes="GroovyTestBad1.groovy" fork="true"/>
-        <java classname="org.codehaus.groovy.ant.GroovycTest1"/>
+        <compile-plain includes="GroovyTestBad1.groovy" fork="true"/>
     </target>
 
     <target name="noForkNoAntRuntime">
-        <groovyc srcdir="${srcPath}" destdir="${destPath}" 
includes="GroovycTest1.groovy" fork="false" includeAntRuntime="false"/>
+        <compile-plain includes="GroovycTest1.groovy" fork="false" 
includeAntRuntime="false"/>
     </target>
 
     <!-- GROOVY-9197 -->
     <target name="jointForkedCompilation_ExternalJarOnClasspath">
-        <presetdef name="compile">
-            <groovyc fork="true" includeantruntime="false">
-                <javac debug="true" source="${javaVersion}" 
target="${javaVersion}"/>
-            </groovyc>
-        </presetdef>
-
         <path id="the.classpath">
             <path refid="groovyMaterials"/>
             <fileset file="commons-lang3-3.4.jar"/>
         </path>
 
-        <compile srcdir="${srcPath}" destdir="${destPath}" 
includes="MakesExternalReference.java">
+        <compile-joint fork="true" includeantruntime="false" 
includes="MakesExternalReference.java">
             <classpath refid="the.classpath"/>
-        </compile>
+        </compile-joint>
 
         <java classname="org.codehaus.groovy.ant.MakesExternalReference" 
classpathref="the.classpath"/>
     </target>
 
+    <!-- GROOVY-11573 -->
+    <target name="jointForkedCompilation_ParameterMetadataCheck">
+        <compile-joint fork="true" configscript="params.groovy" 
includes="ParameterMetadataCheck.java"/>
+        <java classname="org.codehaus.groovy.ant.ParameterMetadataCheck"/>
+    </target>
+
     <target name="clean">
         <delete quiet="true">
             <fileset dir="${destPath}/org/codehaus/groovy/ant">
+                <include name="*_Result.txt"/>
                 <include name="GroovycTest1*.class"/>
                 <include name="GroovycTest2*.class"/>
                 <include name="IncorrectGenericsUsage.class"/>
                 <include name="MakesExternalReference.class"/>
+                <include name="ParameterMetadataCheck.class"/>
             </fileset>
         </delete>
     </target>
diff --git 
a/subprojects/groovy-ant/src/test-resources/org/codehaus/groovy/ant/GroovycTest2.java
 
b/subprojects/groovy-ant/src/test-resources/org/codehaus/groovy/ant/GroovycTest2.java
index b421a19005..8f5057d4f0 100644
--- 
a/subprojects/groovy-ant/src/test-resources/org/codehaus/groovy/ant/GroovycTest2.java
+++ 
b/subprojects/groovy-ant/src/test-resources/org/codehaus/groovy/ant/GroovycTest2.java
@@ -22,17 +22,12 @@ import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
 
-class GroovycTest2 {
-    static void main(String[] args) throws IOException {
-        FileOutputStream fout = new FileOutputStream(
-            new 
File("build/classes/groovy/test/org/codehaus/groovy/ant/GroovycTest2_Result.txt"));
-        try {
+public class GroovycTest2 {
+    public static void main(String[] args) throws IOException {
+        File file = new 
File("build/classes/groovy/test/org/codehaus/groovy/ant/GroovycTest2_Result.txt");
+        file.createNewFile();
+        try (FileOutputStream fout = new FileOutputStream(file)) {
             fout.write("OK.".getBytes());
-        } finally {
-            try {
-                fout.close();
-            } catch (IOException ignore) {
-            }
         }
     }
 }
diff --git 
a/subprojects/groovy-ant/src/test-resources/org/codehaus/groovy/ant/GroovycTest2.java
 
b/subprojects/groovy-ant/src/test-resources/org/codehaus/groovy/ant/ParameterMetadataCheck.java
similarity index 72%
copy from 
subprojects/groovy-ant/src/test-resources/org/codehaus/groovy/ant/GroovycTest2.java
copy to 
subprojects/groovy-ant/src/test-resources/org/codehaus/groovy/ant/ParameterMetadataCheck.java
index b421a19005..f21acda704 100644
--- 
a/subprojects/groovy-ant/src/test-resources/org/codehaus/groovy/ant/GroovycTest2.java
+++ 
b/subprojects/groovy-ant/src/test-resources/org/codehaus/groovy/ant/ParameterMetadataCheck.java
@@ -22,17 +22,12 @@ import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
 
-class GroovycTest2 {
-    static void main(String[] args) throws IOException {
-        FileOutputStream fout = new FileOutputStream(
-            new 
File("build/classes/groovy/test/org/codehaus/groovy/ant/GroovycTest2_Result.txt"));
-        try {
+public class ParameterMetadataCheck {
+    public static void main(String[] args) throws IOException {
+        File file = new 
File("build/classes/groovy/test/org/codehaus/groovy/ant/ParameterMetadataCheck_Result.txt");
+        file.createNewFile();
+        try (FileOutputStream fout = new FileOutputStream(file)) {
             fout.write("OK.".getBytes());
-        } finally {
-            try {
-                fout.close();
-            } catch (IOException ignore) {
-            }
         }
     }
 }
diff --git 
a/subprojects/groovy-ant/src/test-resources/org/codehaus/groovy/ant/params.groovy
 
b/subprojects/groovy-ant/src/test-resources/org/codehaus/groovy/ant/params.groovy
new file mode 100644
index 0000000000..d6f2fc7c7d
--- /dev/null
+++ 
b/subprojects/groovy-ant/src/test-resources/org/codehaus/groovy/ant/params.groovy
@@ -0,0 +1 @@
+configuration.parameters=true
diff --git 
a/subprojects/groovy-ant/src/test/groovy/org/codehaus/groovy/ant/GroovycTest.java
 
b/subprojects/groovy-ant/src/test/groovy/org/codehaus/groovy/ant/GroovycTest.java
index 393f4adec1..ff8570ebf0 100644
--- 
a/subprojects/groovy-ant/src/test/groovy/org/codehaus/groovy/ant/GroovycTest.java
+++ 
b/subprojects/groovy-ant/src/test/groovy/org/codehaus/groovy/ant/GroovycTest.java
@@ -44,10 +44,12 @@ import static groovy.test.GroovyAssert.isAtLeastJdk;
  * matter as the tests remove all class files that should not pre-exist from 
this directory at each step.
  */
 public class GroovycTest extends GroovyTestCase {
+
     private final File antFile = new 
File("src/test-resources/org/codehaus/groovy/ant/GroovycTest.xml");
     private Project project;
     private static boolean warned = false;
 
+    @Override
     protected void setUp() {
         project = new Project();
         project.init();
@@ -120,6 +122,70 @@ public class GroovycTest extends GroovyTestCase {
         }
     }
 
+    private void ensureExecutes(final String target) {
+        ensureNotPresent("GroovycTest1");
+        project.executeTarget(target);
+        ensureResultOK("GroovycTest1");
+    }
+
+    private void ensureExecutesWithJavaHome(final String target) {
+        if (project.getProperty("alt.java.home") != null) {
+            ensureExecutes(target);
+        } else {
+            if (!warned) {
+                System.err.println("Forked Java tests skipped, not a sun JDK 
layout");
+                warned = true;
+            }
+        }
+    }
+
+    private void ensureFails(final String target) {
+        File badGroovy = new File(antFile.getParentFile(), 
"GroovyTestBad1.groovy");
+        PrintStream ps = null;
+        try {
+            ps = new PrintStream(new FileOutputStream(badGroovy));
+        } catch (FileNotFoundException e) {
+            fail("Could not create test file:" + badGroovy.getAbsolutePath());
+        }
+        ps.println("class GroovyTest1Bad { Thi$ $hould Fail! (somehow) 
};:??''+_|\\|");
+        ps.close();
+        ensureNotPresent("GroovycTestBad1");
+        try {
+            project.executeTarget(target);
+            fail("Ant script should have failed with execution exception");
+        } catch (BuildException be) {
+            be.printStackTrace();
+            ensureNotPresent("GroovycTestBad1");
+        } finally {
+            badGroovy.delete();
+        }
+    }
+
+    /**
+     * For the code:
+     * private ArrayList<String> x = new ArrayList<String>();
+     * x = (ArrayList)z ;
+     * Upto JDK6, 'javac -Xlint' produces the following output:
+     * found   : java.util.ArrayList
+     * required: java.util.ArrayList<java.lang.String>
+     * But, OpenJDK seems to be producing the following output:
+     * required: ArrayList<String>
+     * found:    ArrayList
+     * So, we first adjust the output a bit, so that difference in the output 
brought in by OpenJDK javac
+     * does not impact the test adversely
+     */
+    private String adjustOutputToHandleOpenJDKJavacOutputDifference(String 
antOutput) {
+        if (!antOutput.contains("java.util.ArrayList") && 
antOutput.contains("ArrayList")) {
+            antOutput = antOutput.replace("ArrayList", "java.util.ArrayList");
+        }
+        if (!antOutput.contains("java.lang.String") && 
antOutput.contains("String")) {
+            antOutput = antOutput.replace("String", "java.lang.String");
+        }
+        return antOutput;
+    }
+
+    
//--------------------------------------------------------------------------
+
     public void testGroovycTest1_NoFork_NoClasspath() {
         if (isAtLeastJdk("18.0")) return; // GROOVY-10479
         ensureExecutes("GroovycTest1_NoFork_NoClasspath");
@@ -141,22 +207,18 @@ public class GroovycTest extends GroovyTestCase {
     }
 
     public void testGroovycTest1_ForkGroovy_NoClasspath() {
-        if (isAtLeastJdk("18.0")) return; // GROOVY-10479
         ensureExecutes("GroovycTest1_ForkGroovy_NoClasspath");
     }
 
     public void testGroovycTest1_ForkGroovy_WithGroovyClasspath() {
-        if (isAtLeastJdk("18.0")) return; // GROOVY-10479
         ensureExecutes("GroovycTest1_ForkGroovy_WithGroovyClasspath");
     }
 
     public void testGroovycTest1_ForkGroovy_WithJavaClasspath() {
-        if (isAtLeastJdk("18.0")) return; // GROOVY-10479
         ensureExecutes("GroovycTest1_ForkGroovy_WithJavaClasspath");
     }
 
     public void testGroovycTest1_ForkGroovy_WithBothClasspath() {
-        if (isAtLeastJdk("18.0")) return; // GROOVY-10479
         ensureExecutes("GroovycTest1_ForkGroovy_WithBothClasspath");
     }
 
@@ -192,29 +254,6 @@ public class GroovycTest extends GroovyTestCase {
         }
     }
 
-    /**
-     * For the code:
-     * private ArrayList<String> x = new ArrayList<String>();
-     * x = (ArrayList)z ;
-     * Upto JDK6, 'javac -Xlint' produces the following output:
-     * found   : java.util.ArrayList
-     * required: java.util.ArrayList<java.lang.String>
-     * But, OpenJDK seems to be producing the following output:
-     * required: ArrayList<String>
-     * found:    ArrayList
-     * So, we first adjust the output a bit, so that difference in the output 
brought in by OpenJDK javac
-     * does not impact the test adversely
-     */
-    private String adjustOutputToHandleOpenJDKJavacOutputDifference(String 
antOutput) {
-        if (!antOutput.contains("java.util.ArrayList") && 
antOutput.contains("ArrayList")) {
-            antOutput = antOutput.replace("ArrayList", "java.util.ArrayList");
-        }
-        if (!antOutput.contains("java.lang.String") && 
antOutput.contains("String")) {
-            antOutput = antOutput.replace("String", "java.lang.String");
-        }
-        return antOutput;
-    }
-
     public void testGroovycTest1_Joint_NoFork_WithJavaClasspath() {
         if (isAtLeastJdk("18.0")) return; // GROOVY-10479
         ensureExecutes("GroovycTest1_Joint_NoFork_WithJavaClasspath");
@@ -226,22 +265,18 @@ public class GroovycTest extends GroovyTestCase {
     }
 
     public void testGroovycTest1_Joint_ForkGroovy_NoClasspath() {
-        if (isAtLeastJdk("18.0")) return; // GROOVY-10479
         ensureExecutes("GroovycTest1_Joint_ForkGroovy_NoClasspath");
     }
 
     public void testGroovycTest1_Joint_ForkGroovy_WithGroovyClasspath() {
-        if (isAtLeastJdk("18.0")) return; // GROOVY-10479
         ensureExecutes("GroovycTest1_Joint_ForkGroovy_WithGroovyClasspath");
     }
 
     public void testGroovycTest1_Joint_ForkGroovy_WithJavaClasspath() {
-        if (isAtLeastJdk("18.0")) return; // GROOVY-10479
         ensureExecutes("GroovycTest1_Joint_ForkGroovy_WithJavaClasspath");
     }
 
     public void testGroovycTest1_Joint_ForkGroovy_WithBothClasspath() {
-        if (isAtLeastJdk("18.0")) return; // GROOVY-10479
         ensureExecutes("GroovycTest1_Joint_ForkGroovy_WithBothClasspath");
     }
 
@@ -271,48 +306,19 @@ public class GroovycTest extends GroovyTestCase {
 
     // GROOVY-9197
     public void testJointCompilationPropagatesClasspath() {
-        if (isAtLeastJdk("18.0")) return; // GROOVY-10479
         ensureNotPresent("MakesExternalReference");
         project.executeTarget("jointForkedCompilation_ExternalJarOnClasspath");
         ensureResultOK("MakesExternalReference");
     }
 
-    private void ensureExecutes(String target) {
-        ensureNotPresent("GroovycTest1");
-        project.executeTarget(target);
-        ensureResultOK("GroovycTest1");
-    }
-
-    private void ensureExecutesWithJavaHome(String target) {
-        if (project.getProperty("alt.java.home") != null) {
-            ensureExecutes(target);
-        } else {
-            if (!warned) {
-                System.err.println("Forked Java tests skipped, not a sun JDK 
layout");
-                warned = true;
-            }
-        }
-    }
+    // GROOVY-11573
+    public void testJointCompilationPropagatesParameters() throws Exception {
+        ensureNotPresent("ParameterMetadataCheck");
+        project.executeTarget("jointForkedCompilation_ParameterMetadataCheck");
+        ensureResultOK("ParameterMetadataCheck");
 
-    private void ensureFails(String target) {
-        File badGroovy = new File(antFile.getParentFile(), 
"GroovyTestBad1.groovy");
-        PrintStream ps = null;
-        try {
-            ps = new PrintStream(new FileOutputStream(badGroovy));
-        } catch (FileNotFoundException e) {
-            fail("Could not create test file:" + badGroovy.getAbsolutePath());
-        }
-        ps.println("class GroovyTest1Bad { Thi$ $hould Fail! (somehow) 
};:??''+_|\\|");
-        ps.close();
-        ensureNotPresent("GroovycTestBad1");
-        try {
-            project.executeTarget(target);
-            fail("Ant script should have failed with execution exception");
-        } catch (BuildException be) {
-            be.printStackTrace();
-            ensureNotPresent("GroovycTestBad1");
-        } finally {
-            badGroovy.delete();
-        }
+        var c = 
Class.forName("org.codehaus.groovy.ant.ParameterMetadataCheck");
+        var m = c.getDeclaredMethod("main", String[].class);
+        assertEquals("args",m.getParameters()[0].getName());
     }
 }

Reply via email to