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 2026/09/12 16:57:52 UTC

(groovy) 02/04: add bounds checks

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

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

commit 1ff68443df6c36b27218d8bba72804ce99619185
Author: Eric Milles <er...@thomsonreuters.com>
AuthorDate: Sat Sep 12 11:52:49 2026 -0500

    add bounds checks
---
 src/main/java/org/codehaus/groovy/ast/GenericsType.java | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/main/java/org/codehaus/groovy/ast/GenericsType.java b/src/main/java/org/codehaus/groovy/ast/GenericsType.java
index 34186904dd..9e9f253ad3 100644
--- a/src/main/java/org/codehaus/groovy/ast/GenericsType.java
+++ b/src/main/java/org/codehaus/groovy/ast/GenericsType.java
@@ -311,6 +311,10 @@ public class GenericsType extends ASTNode {
         this.placeholder = placeholder;
         this.resolved = resolved || placeholder;
         this.wildcard = wildcard && !placeholder;
+        if (placeholder) {
+            assert lowerBound  == null                                                             : "type param cannot have lower bound";
+            assert upperBounds == null || Arrays.stream(upperBounds).noneMatch(ClassNode::isArray) : "type param cannot have array bound";
+        }
         getType().setGenericsPlaceHolder(placeholder);
     }