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/08/18 11:35:23 UTC

(groovy) branch master updated: minor refactor: clarify behaviour

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


The following commit(s) were added to refs/heads/master by this push:
     new 78215f033a minor refactor: clarify behaviour
78215f033a is described below

commit 78215f033a06ddce066e14ff5fea8da7138810a0
Author: Paul King <pa...@asert.com.au>
AuthorDate: Tue Aug 18 21:35:14 2026 +1000

    minor refactor: clarify behaviour
---
 .../groovy/control/customizers/SecureASTCustomizer.java       | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/main/java/org/codehaus/groovy/control/customizers/SecureASTCustomizer.java b/src/main/java/org/codehaus/groovy/control/customizers/SecureASTCustomizer.java
index 6d2e2b07be..db1086c665 100644
--- a/src/main/java/org/codehaus/groovy/control/customizers/SecureASTCustomizer.java
+++ b/src/main/java/org/codehaus/groovy/control/customizers/SecureASTCustomizer.java
@@ -825,9 +825,14 @@ public class SecureASTCustomizer extends CompilationCustomizer {
     }
 
     /**
-     * Set this option to true if you want your import rules to be checked against every class node. This means that if
-     * someone uses a fully qualified class name, then it will also be checked against the import rules, preventing, for
-     * example, instantiation of classes without imports thanks to FQCN.
+     * Set this option to true to apply the import rules to types which appear in the source without an
+     * import statement, most usefully to prevent a class being instantiated by fully qualified name.
+     * <p>
+     * The rules are applied to the constructed type of a constructor call, and to the receiver type of a
+     * method call or a static method call. They are not applied to every class node: class literals,
+     * property and attribute access, cast and declaration types, and catch types are not examined. Note
+     * also that the receiver type is the static type of that expression, which for a dynamically typed
+     * receiver is {@code java.lang.Object} rather than the class the call reaches at runtime.
      *
      * @param indirectImportCheckEnabled set to true to enable indirect checks
      */