You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by em...@apache.org on 2022/03/03 22:21:40 UTC

[groovy] branch groovy3-java16 updated (b8c403d -> 96ad7e9)

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

emilles pushed a change to branch groovy3-java16
in repository https://gitbox.apache.org/repos/asf/groovy.git.


 discard b8c403d  Gradle 7.2 for Java 16+
     new 96ad7e9  Gradle 7.2 for Java 16+

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (b8c403d)
            \
             N -- N -- N   refs/heads/groovy3-java16 (96ad7e9)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../org/codehaus/groovy/gradle/JarJarTask.groovy   | 35 ++++++++++------------
 .../groovy/gradle/ReleaseInfoGenerator.groovy      |  8 ++---
 .../gradle/WriteExtensionDescriptorTask.groovy     |  8 ++---
 3 files changed, 24 insertions(+), 27 deletions(-)

[groovy] 01/01: Gradle 7.2 for Java 16+

Posted by em...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 96ad7e957ff2aa9dfac27a5975a069f48c14bef7
Author: Eric Milles <er...@thomsonreuters.com>
AuthorDate: Thu Mar 3 15:54:58 2022 -0600

    Gradle 7.2 for Java 16+
---
 build.gradle                                       | 37 ++++-----
 .../org/codehaus/groovy/gradle/JarJarTask.groovy   | 35 ++++----
 .../groovy/gradle/ReleaseInfoGenerator.groovy      |  7 +-
 .../gradle/WriteExtensionDescriptorTask.groovy     | 10 +--
 gradle.properties                                  | 96 +++++++++++-----------
 gradle/assemble.gradle                             |  2 +
 gradle/test.gradle                                 |  6 +-
 gradle/wrapper/gradle-wrapper.properties           |  2 +-
 .../groovy/reflection/ReflectionUtils.java         | 20 +++--
 .../groovy/runtime/ProxyGeneratorAdapter.java      | 18 ++--
 subprojects/groovy-json/build.gradle               |  6 +-
 subprojects/groovy-servlet/build.gradle            | 17 ++--
 subprojects/groovy-test-junit5/build.gradle        |  6 +-
 subprojects/groovy-test/build.gradle               | 12 +--
 subprojects/groovy-testng/build.gradle             |  6 +-
 subprojects/groovy-yaml/build.gradle               |  4 +-
 16 files changed, 143 insertions(+), 141 deletions(-)

diff --git a/build.gradle b/build.gradle
index 20d6de6..7b4b796 100644
--- a/build.gradle
+++ b/build.gradle
@@ -26,21 +26,16 @@ buildscript {
         }
         mavenCentral()
         maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
-        maven {
-            url "https://plugins.gradle.org/m2/"
-        }
-        maven {
-            url 'https://jitpack.io'
-        }
+        maven { url 'https://plugins.gradle.org/m2/' }
+        maven { url 'https://jitpack.io' }
     }
 
     dependencies {
         // using the old "classpath" style of plugins because the new one doesn't play well with multi-modules
         classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.5.8'
-        classpath "org.jfrog.buildinfo:build-info-extractor-gradle:3.0.3"
-        //classpath 'nl.javadude.gradle.plugins:license-gradle-plugin:0.11.0'
-        classpath "org.nosphere.apache:creadur-rat-gradle:0.7.0"
-        classpath "gradle.plugin.com.github.jk1:gradle-license-report:1.3"
+        classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:3.0.3'
+        classpath 'org.nosphere.apache:creadur-rat-gradle:0.7.0'
+        classpath 'gradle.plugin.com.github.jk1:gradle-license-report:1.3'
     }
 }
 
@@ -61,12 +56,11 @@ buildScanRecipes {
 ext.modules = {
     subprojects.findAll{ !['performance', 'binary-compatibility'].contains(it.name) }
 }
-ext.isReleaseVersion = !groovyVersion.toLowerCase().endsWith("snapshot")
+ext.isReleaseVersion = !groovyVersion.toLowerCase().endsWith('snapshot')
 
 apply from: 'gradle/bad-practices.gradle'
-//apply from: 'gradle/indy.gradle'
 apply from: 'gradle/publish.gradle'
-apply plugin: "com.github.jk1.dependency-license-report"
+apply plugin: 'com.github.jk1.dependency-license-report'
 
 File javaHome = new File(System.getProperty('java.home'))
 logger.lifecycle "Using Java from $javaHome (version ${System.getProperty('java.version')})"
@@ -115,7 +109,7 @@ task(copyTestResources, type: Copy)
 test.dependsOn(copyTestResources)
 
 repositories {
-    // todo Some repos are needed only for some configs. Declare them just for the configuration once Gradle allows this.
+    // TODO: Some repos are needed only for some configs. Declare them just for the configuration once Gradle allows this.
     maven { url 'https://repository.jboss.org/nexus/content/groups/m2-release-proxy' } // tools
 }
 
@@ -351,12 +345,13 @@ task dgmConverter(dependsOn:compileJava) {
     // Gradle classloading magic with Groovy will only work if it finds a *jar*
     // on classpath. This "bootstrap jar" contains the minimal compiler, without .groovy compiled files
 
-task bootstrapJar(type:Jar ) {
+task bootstrapJar(type: Jar) {
     dependsOn compileJava, dgmConverter
 
     from compileJava.destinationDir
     from dgmConverter.outputDir
 
+    duplicatesStrategy = DuplicatesStrategy.EXCLUDE
     destinationDir = file("$buildDir/bootstrap")
     classifier = 'bootstrap'
 }
@@ -366,6 +361,10 @@ allprojects {
         compileOnly "com.github.spotbugs:spotbugs-annotations:$spotbugsAnnotationsVersion"
     }
 
+    tasks.withType(AbstractCopyTask) {
+        duplicatesStrategy = DuplicatesStrategy.WARN
+    }
+
     tasks.withType(JavaCompile) {
         options.encoding = 'UTF-8'
         options.incremental = true
@@ -431,7 +430,7 @@ apply from: 'gradle/test.gradle'
 apply from: 'gradle/groovydoc.gradle'
 apply from: 'gradle/docs.gradle'
 apply from: 'gradle/assemble.gradle'
-apply from: 'gradle/upload.gradle'
+//apply from: 'gradle/upload.gradle' -- TODO: migrate to Gradle 7
 apply from: 'gradle/idea.gradle'
 apply from: 'gradle/eclipse.gradle'
 apply from: 'gradle/quality.gradle'
@@ -467,8 +466,8 @@ licenseReport {
 def checkRepo(repo) {
     if (repo instanceof MavenArtifactRepository) {
         def repoUrl = repo.url.toString()
-        if (repoUrl.startsWith("http://")) {
-            throw new GradleException("Build should not use insecure HTTP-based URLs for repositories. Found: " + repoUrl)
+        if (repoUrl.startsWith('http://')) {
+            throw new GradleException("Build should not use insecure HTTP-based URLs for repositories. Found: $repoUrl")
         }
     }
 }
@@ -484,7 +483,7 @@ project.afterEvaluate {
 
 def UNSTABLE = /^([\d.-]+(alpha|beta|rc|ea|b|m)[\d.-]+(groovy[\d.-]+)?|2.4.0-b[\d.]+|200\d{5}(\.\d{6})?|2004-03-19)$/
 // ignore non-stable releases
-tasks.named("dependencyUpdates")?.configure {
+tasks.named('dependencyUpdates')?.configure {
     gradleReleaseChannel = 'current'
     rejectVersionIf {
         !(it.currentVersion.toLowerCase() ==~ UNSTABLE) && it.candidate.version.toLowerCase() ==~ UNSTABLE
diff --git a/buildSrc/src/main/groovy/org/codehaus/groovy/gradle/JarJarTask.groovy b/buildSrc/src/main/groovy/org/codehaus/groovy/gradle/JarJarTask.groovy
index df5588f..c5b23ea 100644
--- a/buildSrc/src/main/groovy/org/codehaus/groovy/gradle/JarJarTask.groovy
+++ b/buildSrc/src/main/groovy/org/codehaus/groovy/gradle/JarJarTask.groovy
@@ -25,6 +25,10 @@ import org.gradle.api.file.FileCollection
 import org.gradle.api.java.archives.Manifest
 import org.gradle.api.tasks.CacheableTask
 import org.gradle.api.tasks.Input
+import org.gradle.api.tasks.InputFile
+import org.gradle.api.tasks.InputFiles
+import org.gradle.api.tasks.Internal
+import org.gradle.api.tasks.Optional
 import org.gradle.api.tasks.OutputFile
 import org.gradle.api.tasks.TaskAction
 
@@ -32,48 +36,42 @@ import org.gradle.api.tasks.TaskAction
 class JarJarTask extends DefaultTask {
     private final static String JARJAR_CLASS_NAME = 'org.pantsbuild.jarjar.JarJarTask'
 
-    String description = "Repackages dependencies into a shaded jar"
+    @Internal final String description = 'Repackages dependencies into a shaded jar'
 
     private List<Action<? super Manifest>> manifestTweaks = []
 
-    @Input
+    @InputFile
     File from
 
-    @Input
+    @InputFiles
     FileCollection repackagedLibraries
 
-    @Input
+    @InputFiles
     FileCollection jarjarToolClasspath
 
-    @Input
-    @org.gradle.api.tasks.Optional
+    @Optional @Input
     List<String> untouchedFiles = []
 
-    @Input
-    @org.gradle.api.tasks.Optional
+    @Optional @Input
     List<String> excludes = []
 
     @Input
     Map<String, String> patterns
 
-    @Input
-    @org.gradle.api.tasks.Optional
+    @Optional @Input
     Map<String, List<String>> excludesPerLibrary = [:]
 
-    @Input
-    @org.gradle.api.tasks.Optional
+    @Optional @Input
     Map<String, List<String>> includesPerLibrary = [:]
 
-    @Input
-    @org.gradle.api.tasks.Optional
+    @Optional @Input
     Map<String, String> includedResources = [:]
 
     @OutputFile
     File outputFile
 
-    @Input
-    @org.gradle.api.tasks.Optional
-    boolean createManifest = true
+    @Optional @Input
+    Boolean createManifest = true
 
     void withManifest(Action<? super Manifest> action) {
         manifestTweaks << action
@@ -164,5 +162,4 @@ class JarJarTask extends DefaultTask {
     private static String baseName(File file) {
         file.name.substring(0, file.name.lastIndexOf('-'))
     }
-
-}
\ No newline at end of file
+}
diff --git a/buildSrc/src/main/groovy/org/codehaus/groovy/gradle/ReleaseInfoGenerator.groovy b/buildSrc/src/main/groovy/org/codehaus/groovy/gradle/ReleaseInfoGenerator.groovy
index b29193c..26f1ab1 100644
--- a/buildSrc/src/main/groovy/org/codehaus/groovy/gradle/ReleaseInfoGenerator.groovy
+++ b/buildSrc/src/main/groovy/org/codehaus/groovy/gradle/ReleaseInfoGenerator.groovy
@@ -22,13 +22,15 @@ import groovy.transform.CompileStatic
 import org.gradle.api.DefaultTask
 import org.gradle.api.tasks.TaskAction
 import org.gradle.api.tasks.Input
+import org.gradle.api.tasks.Internal
 import org.gradle.api.tasks.OutputFile
 
 import java.text.SimpleDateFormat
 
 @CompileStatic
 class ReleaseInfoGenerator extends DefaultTask {
-    String description = "Generates the release info properties file"
+    @Internal
+    final String description = 'Generates the release info properties file'
 
     @Input
     String version
@@ -74,5 +76,4 @@ BuildTime=$time
 """)
         }
     }
-
-}
\ No newline at end of file
+}
diff --git a/buildSrc/src/main/groovy/org/codehaus/groovy/gradle/WriteExtensionDescriptorTask.groovy b/buildSrc/src/main/groovy/org/codehaus/groovy/gradle/WriteExtensionDescriptorTask.groovy
index 2e16102..85f0892 100644
--- a/buildSrc/src/main/groovy/org/codehaus/groovy/gradle/WriteExtensionDescriptorTask.groovy
+++ b/buildSrc/src/main/groovy/org/codehaus/groovy/gradle/WriteExtensionDescriptorTask.groovy
@@ -21,17 +21,17 @@ package org.codehaus.groovy.gradle
 import org.gradle.api.DefaultTask
 import org.gradle.api.tasks.TaskAction
 import org.gradle.api.tasks.Input
+import org.gradle.api.tasks.Internal
 import org.gradle.api.tasks.OutputFile
 
 /**
  * A Gradle task to generate module descriptor files for Groovy extension modules.
  */
 class WriteExtensionDescriptorTask extends DefaultTask {
-    String description = 'Generates the org.codehaus.groovy.runtime.ExtensionModule descriptor file of a module'
-    @Input String extensionClasses = ''
-    @Input String staticExtensionClasses = ''
+    @Internal final String description = 'Generates the org.codehaus.groovy.runtime.ExtensionModule descriptor file of a module'
     @OutputFile File descriptor = computeDescriptorFile()
-
+    @Input String staticExtensionClasses = ''
+    @Input String extensionClasses = ''
 
     private File computeDescriptorFile() {
         def metaInfDir = new File("${project.buildDir}/resources/main/META-INF/groovy")
@@ -48,6 +48,4 @@ extensionClasses=${extensionClasses}
 staticExtensionClasses=${staticExtensionClasses}"""
         }
     }
-
 }
-
diff --git a/gradle.properties b/gradle.properties
index b64dc2e..6669015 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,48 +1,48 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-groovyVersion = 3.0.10-SNAPSHOT
-# bundle version format: major('.'minor('.'micro('.'qualifier)?)?)? (first 3 only digits)
-groovyBundleVersion = 3.0.10.SNAPSHOT
-
-binaryCompatibilityBaseline = 3.0.5
-gradle_version=6.9.2
-
-groovyJUnit_ms=512m
-groovyJUnit_mx=2g
-groovyJUnit_permSize=64m
-groovyJUnit_maxPermSize=256m
-
-javacMain_mx=512m
-groovycMain_mx=1g
-groovycTest_mx=1g
-
-javaDoc_mx=1g
-
-# adjust if needed for different jdk versions
-#org.gradle.jvmargs=-ea -Xmx1500m
-org.gradle.jvmargs=-Xms800m -Xmx2g -XX:MaxMetaspaceSize=512m -XX:+UseG1GC
-
-# enable the Gradle build cache
-org.gradle.caching=true
-
-# enable --parallel
-org.gradle.parallel=true
-
-# prefer jars over class folders on the compile classpath
-org.gradle.java.compile-classpath-packaging=true
-
-# enables watching the file-system
-org.gradle.unsafe.watch-fs=true
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+groovyVersion = 3.0.10-SNAPSHOT
+# bundle version format: major('.'minor('.'micro('.'qualifier)?)?)? (first 3 only digits)
+groovyBundleVersion = 3.0.10.SNAPSHOT
+
+binaryCompatibilityBaseline = 3.0.5
+gradle_version=7.2
+
+groovyJUnit_ms=512m
+groovyJUnit_mx=2g
+groovyJUnit_permSize=64m
+groovyJUnit_maxPermSize=256m
+
+javacMain_mx=512m
+groovycMain_mx=1g
+groovycTest_mx=1g
+
+javaDoc_mx=1g
+
+# adjust if needed for different jdk versions
+#org.gradle.jvmargs=-ea -Xmx1500m
+org.gradle.jvmargs=-Xms800m -Xmx2g -XX:MaxMetaspaceSize=512m -XX:+UseG1GC
+
+# enable the Gradle build cache
+org.gradle.caching=true
+
+# enable --parallel
+org.gradle.parallel=true
+
+# prefer jars over class folders on the compile classpath
+org.gradle.java.compile-classpath-packaging=true
+
+# enables watching the file-system
+org.gradle.unsafe.watch-fs=true
diff --git a/gradle/assemble.gradle b/gradle/assemble.gradle
index 9cb26cf..a074dec 100644
--- a/gradle/assemble.gradle
+++ b/gradle/assemble.gradle
@@ -165,6 +165,7 @@ allprojects {
 
     def producedJars = [jar]
     jar {
+        duplicatesStrategy = DuplicatesStrategy.WARN
         appendix = 'raw'
         manifest {
             from(allManifest) {
@@ -179,6 +180,7 @@ allprojects {
     if (rootProject.indyCapable()) {
         task jarWithIndy(type: Jar) {
             dependsOn compileGroovyWithIndy
+            duplicatesStrategy = DuplicatesStrategy.WARN
             classifier = 'indy'
             appendix = 'raw'
             from sourceSets.main.java.outputDir
diff --git a/gradle/test.gradle b/gradle/test.gradle
index cd9d2b6..f53a78c 100644
--- a/gradle/test.gradle
+++ b/gradle/test.gradle
@@ -53,10 +53,8 @@ allprojects {
 
     // create an Indy test suite
     if (rootProject.indyCapable()) {
-        def dependencies = configurations.testRuntime.incoming.dependencies.findAll {
-            it.name.startsWith('groovy')
-        }.collect {
-            it.name
+        def dependencies = configurations.testRuntimeOnly.incoming.dependencies.findResults {
+            if (it.name.startsWith('groovy')) return it.name
         }
         task testWithIndy(type: Test) {
             systemProperties 'groovy.target.indy': true
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index ec991f9..ffed3a2 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
 distributionBase=GRADLE_USER_HOME
 distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.2-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
 zipStoreBase=GRADLE_USER_HOME
 zipStorePath=wrapper/dists
diff --git a/src/main/java/org/codehaus/groovy/reflection/ReflectionUtils.java b/src/main/java/org/codehaus/groovy/reflection/ReflectionUtils.java
index 411b79d..83c7b55 100644
--- a/src/main/java/org/codehaus/groovy/reflection/ReflectionUtils.java
+++ b/src/main/java/org/codehaus/groovy/reflection/ReflectionUtils.java
@@ -133,6 +133,14 @@ public class ReflectionUtils {
         }
     }
 
+    private static boolean classShouldBeIgnored(final Class c, final Collection<String> extraIgnoredPackages) {
+        return (c != null
+                && (c.isSynthetic()
+                    || (c.getPackage() != null
+                        && (IGNORED_PACKAGES.contains(c.getPackage().getName())
+                          || extraIgnoredPackages.contains(c.getPackage().getName())))));
+    }
+
     public static List<Method> getDeclaredMethods(final Class<?> type, final String name, final Class<?>... parameterTypes) {
         return doGetMethods(type, name, parameterTypes, Class::getDeclaredMethods);
     }
@@ -225,12 +233,12 @@ public class ReflectionUtils {
         }
     }
 
-    private static boolean classShouldBeIgnored(final Class c, final Collection<String> extraIgnoredPackages) {
-        return (c != null
-                && (c.isSynthetic()
-                    || (c.getPackage() != null
-                        && (IGNORED_PACKAGES.contains(c.getPackage().getName())
-                          || extraIgnoredPackages.contains(c.getPackage().getName())))));
+    public static boolean isSealed(Class<?> c) {
+        try {
+            return Boolean.TRUE.equals(Class.class.getMethod("isSealed").invoke(c));
+        } catch (ReflectiveOperationException | SecurityException ignore) {
+        }
+        return false;
     }
 
     private static class ClassContextHelper extends SecurityManager {
diff --git a/src/main/java/org/codehaus/groovy/runtime/ProxyGeneratorAdapter.java b/src/main/java/org/codehaus/groovy/runtime/ProxyGeneratorAdapter.java
index 23c4017..c7cf63f 100644
--- a/src/main/java/org/codehaus/groovy/runtime/ProxyGeneratorAdapter.java
+++ b/src/main/java/org/codehaus/groovy/runtime/ProxyGeneratorAdapter.java
@@ -61,6 +61,8 @@ import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.atomic.AtomicLong;
 
+import static org.codehaus.groovy.reflection.ReflectionUtils.isSealed;
+
 /**
  * A proxy generator responsible for mapping a map of closures to a class implementing a list of interfaces. For
  * example, the following code:
@@ -145,7 +147,7 @@ public class ProxyGeneratorAdapter extends ClassVisitor implements Opcodes {
             final ClassLoader proxyLoader,
             final boolean emptyBody,
             final Class delegateClass) {
-        super(CompilerConfiguration.ASM_API_VERSION, new ClassWriter(0));
+        super(CompilerConfiguration.ASM_API_VERSION, new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS));
         this.loader = proxyLoader != null ? createInnerLoader(proxyLoader, interfaces) : findClassLoader(superClass, interfaces);
         this.visitedMethods = new LinkedHashSet<Object>();
         this.delegatedClosures = closureMap.isEmpty() ? EMPTY_DELEGATECLOSURE_MAP : new HashMap<String, Boolean>();
@@ -172,11 +174,13 @@ public class ProxyGeneratorAdapter extends ClassVisitor implements Opcodes {
         this.superClass = fixedSuperClass;
 
         // create the base list of classes which have possible methods to be overloaded
-        this.classList = new LinkedHashSet<Class>();
+        this.classList = new LinkedHashSet<>();
         this.classList.add(superClass);
         if (generateDelegateField) {
-            classList.add(delegateClass);
-            Collections.addAll(this.classList, delegateClass.getInterfaces());
+            this.classList.add(delegateClass);
+            for (Class<?> i : delegateClass.getInterfaces()) {
+                if (!isSealed(i)) this.classList.add(i);
+            }
         }
         if (interfaces != null) {
             Collections.addAll(this.classList, interfaces);
@@ -185,9 +189,9 @@ public class ProxyGeneratorAdapter extends ClassVisitor implements Opcodes {
         this.emptyBody = emptyBody;
 
         // generate bytecode
-        ClassWriter writer = (ClassWriter) cv;
-        this.visit(Opcodes.V1_5, ACC_PUBLIC, proxyName, null, null, null);
-        byte[] b = writer.toByteArray();
+        int bytecodeVersion = CompilerConfiguration.JDK_TO_BYTECODE_VERSION_MAP.get(CompilerConfiguration.DEFAULT.getTargetBytecode());
+        this.visit(bytecodeVersion, ACC_PUBLIC, proxyName, null, null, null);
+        byte[] b = ((ClassWriter) cv).toByteArray();
 //        CheckClassAdapter.verify(new ClassReader(b), true, new PrintWriter(System.err));
         cachedClass = loader.defineClass(proxyName.replace('/', '.'), b);
         // cache no-arg constructor
diff --git a/subprojects/groovy-json/build.gradle b/subprojects/groovy-json/build.gradle
index d9674ff..6b2e5ca 100644
--- a/subprojects/groovy-json/build.gradle
+++ b/subprojects/groovy-json/build.gradle
@@ -21,9 +21,9 @@ dependencies {
     testImplementation project(':groovy-test')
     testImplementation project(':groovy-dateutil')
     testImplementation 'net.javacrumbs.json-unit:json-unit:2.9.0'
-    testRuntime 'com.google.code.gson:gson:2.8.7' // json-unit requires gson, jackson1, or jackson2
-    testRuntime "org.slf4j:slf4j-api:$slf4jVersion"
-    testRuntime project(':groovy-ant') // for JavadocAssertionTests
+    testRuntimeOnly project(':groovy-ant') // for JavadocAssertionTests
+    testRuntimeOnly 'com.google.code.gson:gson:2.8.7' // json-unit requires gson, jackson1, or jackson2
+    testRuntimeOnly "org.slf4j:slf4j-api:$slf4jVersion"
 }
 
 eclipse.classpath.file.whenMerged {
diff --git a/subprojects/groovy-servlet/build.gradle b/subprojects/groovy-servlet/build.gradle
index eb83925..5857fd4 100644
--- a/subprojects/groovy-servlet/build.gradle
+++ b/subprojects/groovy-servlet/build.gradle
@@ -17,22 +17,17 @@
  *  under the License.
  */
 dependencies {
-    api("javax.servlet:javax.servlet-api:$servletApiVersion") { dep ->
-        provided dep
-    }
-    api("javax.servlet.jsp:javax.servlet.jsp-api:$jspApiVersion") { dep ->
-        provided dep
+    api rootProject  // ServletBinding extends Binding...
+    api "javax.servlet:javax.servlet-api:$servletApiVersion"
+    api("javax.servlet.jsp:javax.servlet.jsp-api:$jspApiVersion") {
         exclude(group: 'javax.servlet', module: 'javax.servlet-api')
     }
 
-    api rootProject  // ServletBinding extends Binding...
-    // needed for MarkupBuilder
-    implementation project(':groovy-xml')
-    // needed by TemplateServlet
-    implementation project(':groovy-templates')
+    implementation project(':groovy-xml') // for MarkupBuilder
+    implementation project(':groovy-templates') // by TemplateServlet
 
     testImplementation "jmock:jmock:$jmockVersion"
-    testImplementation rootProject.sourceSets.test.runtimeClasspath
     testImplementation project(':groovy-json')
     testImplementation project(':groovy-test')
+    testImplementation rootProject.sourceSets.test.runtimeClasspath
 }
diff --git a/subprojects/groovy-test-junit5/build.gradle b/subprojects/groovy-test-junit5/build.gradle
index d998353..f30695c 100644
--- a/subprojects/groovy-test-junit5/build.gradle
+++ b/subprojects/groovy-test-junit5/build.gradle
@@ -29,10 +29,10 @@ dependencies {
     implementation("org.junit.jupiter:junit-jupiter-engine:$junit5Version") {
         exclude(group: 'org.apiguardian', module: 'apiguardian-api')
     }
-    testImplementation "org.junit.jupiter:junit-jupiter-params:$junit5Version"
-    testRuntime "org.junit.platform:junit-platform-engine:$junit5PlatformVersion"
-    testRuntime "org.junit.platform:junit-platform-runner:$junit5PlatformVersion"
     testImplementation project(':groovy-test')
+    testImplementation "org.junit.jupiter:junit-jupiter-params:$junit5Version"
+    testRuntimeOnly "org.junit.platform:junit-platform-engine:$junit5PlatformVersion"
+    testRuntimeOnly "org.junit.platform:junit-platform-runner:$junit5PlatformVersion"
 }
 
 tasks.withType(JavaCompile) {
diff --git a/subprojects/groovy-test/build.gradle b/subprojects/groovy-test/build.gradle
index d70e688..e47c951 100644
--- a/subprojects/groovy-test/build.gradle
+++ b/subprojects/groovy-test/build.gradle
@@ -22,14 +22,14 @@ ext {
 }
 
 dependencies {
-    api rootProject   // GroovyTestCase uses Closure...
-    api "junit:junit:$junitVersion" // GroovyTestCase extends TestCase...
-    // groovy-ant needed for FileNameFinder used in AllTestSuite and JavadocAssertionTestSuite
-    testRuntime(project(':groovy-ant')) {
+    api rootProject // GroovyTestCase uses Closure
+    api "junit:junit:$junitVersion" // GroovyTestCase extends TestCase
+
+    testRuntimeOnly(project(':groovy-ant')) { // for FileNameFinder (used in AllTestSuite and JavadocAssertionTestSuite)
         transitive = false // bring in just what we need below
     }
-    testRuntime "org.apache.ant:ant:$antVersion"
-    testRuntime "org.apache.ant:ant-launcher:$antVersion"
+    testRuntimeOnly "org.apache.ant:ant:$antVersion"
+    testRuntimeOnly "org.apache.ant:ant-launcher:$antVersion"
 }
 
 eclipse.classpath.file.whenMerged {
diff --git a/subprojects/groovy-testng/build.gradle b/subprojects/groovy-testng/build.gradle
index 3e5545e..b16facd 100644
--- a/subprojects/groovy-testng/build.gradle
+++ b/subprojects/groovy-testng/build.gradle
@@ -18,12 +18,12 @@
  */
 dependencies {
     api rootProject // TestNgRunner implements GroovyRunner...
-    runtime('org.testng:testng:7.5') {
-        exclude(group: 'com.google.inject', module: 'guice')
+    runtimeOnly('org.testng:testng:7.5') {
         exclude(group: 'com.google.code.findbugs', module: 'jsr305')
-        exclude(group: 'junit', module: 'junit')
+        exclude(group: 'com.google.inject', module: 'guice')
         exclude(group: 'org.apache.ant', module: 'ant')
         exclude(group: 'org.yaml', module: 'snakeyaml')
+        exclude(group: 'junit', module: 'junit')
     }
     testImplementation project(':groovy-test')
 }
diff --git a/subprojects/groovy-yaml/build.gradle b/subprojects/groovy-yaml/build.gradle
index f413bf7..32fedd6 100644
--- a/subprojects/groovy-yaml/build.gradle
+++ b/subprojects/groovy-yaml/build.gradle
@@ -27,8 +27,8 @@ dependencies {
     implementation "com.fasterxml.jackson.core:jackson-databind:$jacksonVersion"
     implementation project(':groovy-json')
     testImplementation project(':groovy-test')
-    testRuntime "com.fasterxml.jackson.core:jackson-annotations:$jacksonVersion"
-    testRuntime project(':groovy-ant') // for JavadocAssertionTests
+    testRuntimeOnly project(':groovy-ant') // for JavadocAssertionTests
+    testRuntimeOnly "com.fasterxml.jackson.core:jackson-annotations:$jacksonVersion"
 }
 
 eclipse.classpath.file.whenMerged {