You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2026/09/05 11:42:19 UTC

(groovy) 04/04: Import the types that recent core, concurrent and JMX changes spelled out in full

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

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

commit 66fe0a14919725da84d6e2b4ea04655811dcc4dc
Author: Paul King <pa...@asert.com.au>
AuthorDate: Sat Sep 5 21:38:02 2026 +1000

    Import the types that recent core, concurrent and JMX changes spelled out in full
---
 src/main/java/groovy/concurrent/ChannelSelect.java         |  2 +-
 src/main/java/groovy/lang/Closure.java                     | 14 ++++++++------
 src/main/java/groovy/lang/MetaClassImpl.java               |  5 +++--
 .../java/org/codehaus/groovy/vmplugin/v8/Selector.java     |  2 +-
 src/test/groovy/groovy/concurrent/ChannelSelectTest.groovy |  3 ++-
 src/test/groovy/groovy/ui/GroovyMainTest.groovy            |  3 ++-
 .../groovy/jmx/builder/JmxServerConnectorFactory.groovy    |  2 +-
 .../jmx/builder/JmxServerConnectorFactoryTest.groovy       |  3 ++-
 8 files changed, 20 insertions(+), 14 deletions(-)

diff --git a/src/main/java/groovy/concurrent/ChannelSelect.java b/src/main/java/groovy/concurrent/ChannelSelect.java
index bba76da652..612fe3356d 100644
--- a/src/main/java/groovy/concurrent/ChannelSelect.java
+++ b/src/main/java/groovy/concurrent/ChannelSelect.java
@@ -326,7 +326,7 @@ public final class ChannelSelect {
      * are ready, the one listed first commits (see {@link #fair()} for a
      * rotating choice and {@link #random()} for a random one). Cancelling the
      * result (for example through
-     * {@link Awaitable#orTimeout(long, java.util.concurrent.TimeUnit)})
+     * {@link Awaitable#orTimeout(long, TimeUnit)})
      * withdraws the pending offers, so a timed-out select consumes nothing
      * and sends nothing. To take a timeout as a branch instead of an
      * exception, add a timer offer from {@link #after(long)} or receive
diff --git a/src/main/java/groovy/lang/Closure.java b/src/main/java/groovy/lang/Closure.java
index e2e36caedc..77a70f9bae 100644
--- a/src/main/java/groovy/lang/Closure.java
+++ b/src/main/java/groovy/lang/Closure.java
@@ -28,6 +28,7 @@ import org.codehaus.groovy.runtime.CurriedClosure;
 import org.codehaus.groovy.runtime.GeneratedClosure;
 import org.codehaus.groovy.runtime.InvokerHelper;
 import org.codehaus.groovy.runtime.InvokerInvocationException;
+import org.codehaus.groovy.runtime.MethodClosure;
 import org.codehaus.groovy.runtime.BooleanClosureWrapper;
 import org.codehaus.groovy.runtime.memoize.ConcurrentCommonCache;
 import org.codehaus.groovy.runtime.memoize.ConcurrentSoftCache;
@@ -48,6 +49,7 @@ import java.lang.invoke.MethodType;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
+import java.util.Arrays;
 import java.util.ArrayDeque;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -1457,8 +1459,8 @@ public abstract class Closure<V> extends GroovyObjectSupport implements Cloneabl
      *       while a closure's fields are read, shifting {@link java.io.ObjectInputStream}'s
      *       latest-user-defined loader away from the loader that defined the closure's captured types.</li>
      * </ul>
-     * Groovy's own serializable gadget closures ({@link org.codehaus.groovy.runtime.CurriedClosure},
-     * {@link org.codehaus.groovy.runtime.ComposedClosure}) call this from their {@code private readResolve()}.
+     * Groovy's own serializable gadget closures ({@link CurriedClosure},
+     * {@link ComposedClosure}) call this from their {@code private readResolve()}.
      * Any other {@code Closure} subclass that participates in serialization can opt in the same way (the
      * method is {@code protected static}, so it is reachable from subclasses but not from arbitrary code).
      *
@@ -1522,7 +1524,7 @@ public abstract class Closure<V> extends GroovyObjectSupport implements Cloneabl
      * {@code thisObject}, for the purposes of {@link #checkForReferenceCycle}.
      * <p>
      * A closure which wraps another and invokes it, as
-     * {@link org.codehaus.groovy.runtime.ComposedClosure} and {@code TrampolineClosure} do,
+     * {@link ComposedClosure} and {@code TrampolineClosure} do,
      * recurses through its own fields rather than through the three the cycle check walks by
      * default, so a forged graph would escape the check unless it declares them here.
      * <p>
@@ -1688,8 +1690,8 @@ public abstract class Closure<V> extends GroovyObjectSupport implements Cloneabl
             // invokes its target method; a curried closure uncurries and re-enters), so their
             // doCall declarations, where present, are NOT what the MOP would select — e.g.
             // MethodClosure's vestigial doCall would mis-dispatch a class-owner method pointer.
-            if (org.codehaus.groovy.runtime.MethodClosure.class.isAssignableFrom(type)
-                    || org.codehaus.groovy.runtime.CurriedClosure.class.isAssignableFrom(type)) {
+            if (MethodClosure.class.isAssignableFrom(type)
+                    || CurriedClosure.class.isAssignableFrom(type)) {
                 return NONE;
             }
             Method[] exact = new Method[ARITY_LIMIT];
@@ -1705,7 +1707,7 @@ public abstract class Closure<V> extends GroovyObjectSupport implements Cloneabl
                         continue;
                     }
                     Class<?>[] params = m.getParameterTypes();
-                    if (!seen.add(java.util.Arrays.toString(params))) continue; // overridden below: most-derived wins
+                    if (!seen.add(Arrays.toString(params))) continue; // overridden below: most-derived wins
                     int arity = m.getParameterCount();
                     boolean allObject = true, hasArray = false;
                     for (Class<?> p : params) {
diff --git a/src/main/java/groovy/lang/MetaClassImpl.java b/src/main/java/groovy/lang/MetaClassImpl.java
index 7e48ffeca4..684e283b74 100644
--- a/src/main/java/groovy/lang/MetaClassImpl.java
+++ b/src/main/java/groovy/lang/MetaClassImpl.java
@@ -20,6 +20,7 @@ package groovy.lang;
 
 import groovy.transform.Internal;
 import org.apache.groovy.internal.util.UncheckedThrow;
+import org.apache.groovy.runtime.indy.IndyInvalidation;
 import org.apache.groovy.util.BeanUtils;
 import org.apache.groovy.util.SystemUtil;
 import org.codehaus.groovy.GroovyBugError;
@@ -3888,7 +3889,7 @@ public class MetaClassImpl implements MetaClass, MutableMetaClass {
     /**
      * Searches the class hierarchy for a mutable meta-class bean property on the
      * missing-property path. Linked miss sites re-enter this walk live (no
-     * SwitchPoint fan-out); see {@link org.apache.groovy.runtime.indy.IndyInvalidation}.
+     * SwitchPoint fan-out); see {@link IndyInvalidation}.
      *
      * @param propertyName the property name
      * @param theClass the class to start searching from
@@ -3970,7 +3971,7 @@ public class MetaClassImpl implements MetaClass, MutableMetaClass {
      * <p>
      * <b>6.0 (GROOVY-12191):</b> this walk is retained. Linked miss sites re-enter
      * it live without SwitchPoint fan-out — see
-     * {@link org.apache.groovy.runtime.indy.IndyInvalidation}.
+     * {@link IndyInvalidation}.
      *
      * @param instanceKlazz the runtime receiver class
      * @param methodName the method name
diff --git a/src/main/java/org/codehaus/groovy/vmplugin/v8/Selector.java b/src/main/java/org/codehaus/groovy/vmplugin/v8/Selector.java
index 198a9a73e3..85d55aa413 100644
--- a/src/main/java/org/codehaus/groovy/vmplugin/v8/Selector.java
+++ b/src/main/java/org/codehaus/groovy/vmplugin/v8/Selector.java
@@ -1498,7 +1498,7 @@ public abstract class Selector {
      * {@code callSite.type()}. Guard and switch-point wrapping are intentionally
      * omitted — the caller (compound-assignment) applies its own per-shape guard
      * and the scoped per-class MOP SwitchPoint (see
-     * {@link org.apache.groovy.runtime.indy.IndyInvalidation}). The caller must
+     * {@link IndyInvalidation}). The caller must
      * have already established that {@code methodName} resolves for this receiver
      * (e.g. via {@code respondsTo}); this routes the actual invocation through the
      * same selection, coercion and wrapping path as a normal call.
diff --git a/src/test/groovy/groovy/concurrent/ChannelSelectTest.groovy b/src/test/groovy/groovy/concurrent/ChannelSelectTest.groovy
index 1b5d4e99fd..70887f3f35 100644
--- a/src/test/groovy/groovy/concurrent/ChannelSelectTest.groovy
+++ b/src/test/groovy/groovy/concurrent/ChannelSelectTest.groovy
@@ -684,13 +684,14 @@ final class ChannelSelectTest {
             import groovy.concurrent.ChannelClosedException
             import groovy.concurrent.ChannelSelect
             import java.util.concurrent.ConcurrentHashMap
+            import java.util.concurrent.atomic.AtomicInteger
             import static org.apache.groovy.runtime.async.AsyncSupport.await as awaitFor
 
             def a = AsyncChannel.create(8)
             def b = AsyncChannel.create(8)
             int perChannel = 2000
             def seen = new ConcurrentHashMap<Integer, Boolean>()
-            def duplicates = new java.util.concurrent.atomic.AtomicInteger()
+            def duplicates = new AtomicInteger()
 
             def producers = [
                 Thread.start { for (i in 0..<perChannel) awaitFor(a.send(i)); a.close() },
diff --git a/src/test/groovy/groovy/ui/GroovyMainTest.groovy b/src/test/groovy/groovy/ui/GroovyMainTest.groovy
index f652fee452..7ff737df42 100644
--- a/src/test/groovy/groovy/ui/GroovyMainTest.groovy
+++ b/src/test/groovy/groovy/ui/GroovyMainTest.groovy
@@ -21,6 +21,7 @@ package groovy.ui
 import org.junit.jupiter.api.Disabled
 import org.junit.jupiter.api.Test
 
+import java.lang.reflect.InvocationTargetException
 import java.nio.file.FileSystems
 import java.nio.file.Files
 import java.nio.file.attribute.PosixFilePermissions
@@ -201,7 +202,7 @@ assert new MyConcreteClass() != null"""
         def method = GroovyMain.getDeclaredMethod('processFile', groovy.lang.Script, File)
         method.accessible = true
         try {
-            def thrown = shouldFail(java.lang.reflect.InvocationTargetException) {
+            def thrown = shouldFail(InvocationTargetException) {
                 method.invoke(main, script, file)
             }
             assert thrown.cause instanceof RuntimeException
diff --git a/subprojects/groovy-jmx/src/main/groovy/groovy/jmx/builder/JmxServerConnectorFactory.groovy b/subprojects/groovy-jmx/src/main/groovy/groovy/jmx/builder/JmxServerConnectorFactory.groovy
index a441b425fc..4f22ad1a8a 100644
--- a/subprojects/groovy-jmx/src/main/groovy/groovy/jmx/builder/JmxServerConnectorFactory.groovy
+++ b/subprojects/groovy-jmx/src/main/groovy/groovy/jmx/builder/JmxServerConnectorFactory.groovy
@@ -54,7 +54,7 @@ import java.rmi.server.RMIServerSocketFactory
  * <p>
  * When {@code authenticate} is true a source of credentials must be supplied, being one of
  * {@code passwordFile}, {@code loginConfig}, or a {@code jmx.remote.authenticator} entry
- * holding a {@link javax.management.remote.JMXAuthenticator}. A connector which was asked to
+ * holding a {@link JMXAuthenticator}. A connector which was asked to
  * authenticate but has none of these would start open, so that combination is rejected rather
  * than accepted silently. Any other entry in {@code properties} is passed to the connector
  * environment unaltered.
diff --git a/subprojects/groovy-jmx/src/test/groovy/groovy/jmx/builder/JmxServerConnectorFactoryTest.groovy b/subprojects/groovy-jmx/src/test/groovy/groovy/jmx/builder/JmxServerConnectorFactoryTest.groovy
index a65e09b449..787cd7b064 100644
--- a/subprojects/groovy-jmx/src/test/groovy/groovy/jmx/builder/JmxServerConnectorFactoryTest.groovy
+++ b/subprojects/groovy-jmx/src/test/groovy/groovy/jmx/builder/JmxServerConnectorFactoryTest.groovy
@@ -34,6 +34,7 @@ import javax.management.remote.rmi.RMIConnectorServer
 import javax.net.ssl.SSLContext
 import javax.rmi.ssl.SslRMIClientSocketFactory
 import javax.rmi.ssl.SslRMIServerSocketFactory
+import javax.security.auth.Subject
 
 @ExtendWith(CgroupV2NpeMitigationExtension)
 class JmxServerConnectorFactoryTest {
@@ -159,7 +160,7 @@ class JmxServerConnectorFactoryTest {
     @Test
     void testCallerSuppliedAuthenticatorSatisfiesAuthenticationRequest() {
         def factory = new JmxServerConnectorFactory()
-        def authenticator = { env -> new javax.security.auth.Subject() } as JMXAuthenticator
+        def authenticator = { env -> new Subject() } as JMXAuthenticator
         def env = factory.confiConnectorProperties('rmi', rmi.port,
                 [authenticate: true, (JMXConnectorServer.AUTHENTICATOR): authenticator])