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

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

commit 4b4a464570595d5c266d05ce57eee324e83232b1
Author: Paul King <pa...@asert.com.au>
AuthorDate: Sun Mar 3 13:10:10 2024 +1000

    make non-indy test more lenient
---
 .../org/codehaus/groovy/transform/ImmutableTransformTest.groovy  | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git 
a/src/test/org/codehaus/groovy/transform/ImmutableTransformTest.groovy 
b/src/test/org/codehaus/groovy/transform/ImmutableTransformTest.groovy
index aabe1c4b3b..ec982fab04 100644
--- a/src/test/org/codehaus/groovy/transform/ImmutableTransformTest.groovy
+++ b/src/test/org/codehaus/groovy/transform/ImmutableTransformTest.groovy
@@ -22,6 +22,7 @@ import 
org.codehaus.groovy.control.MultipleCompilationErrorsException
 import org.junit.Test
 
 import static groovy.test.GroovyAssert.assertScript
+import static groovy.test.GroovyAssert.isAtLeastJdk
 import static groovy.test.GroovyAssert.shouldFail
 
 /**
@@ -108,7 +109,10 @@ final class ImmutableTransformTest {
 
     @Test
     void testCloneableFieldNotCloneableObject() {
-        shouldFail CloneNotSupportedException, '''import groovy.transform.*
+        // attempting to access the protected clone() method is illegal from 
JDK16
+        def expectedException = isAtLeastJdk('16.0') ? IllegalAccessException 
: CloneNotSupportedException
+        shouldFail expectedException, '''
+            import groovy.transform.*
             class Dolly {
                 String name
             }
@@ -125,7 +129,8 @@ final class ImmutableTransformTest {
 
     @Test
     void testImmutableListProp() {
-        def objects = new GroovyShell().evaluate '''import groovy.transform.*
+        def objects = new GroovyShell().evaluate '''
+            import groovy.transform.*
             @Immutable class HasList {
                 char[] letters
                 List   numbers

Reply via email to