File tree 1 file changed +7
-2
lines changed
src/test/org/codehaus/groovy/transform
1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ import org.codehaus.groovy.control.MultipleCompilationErrorsException
22
22
import org.junit.Test
23
23
24
24
import static groovy.test.GroovyAssert.assertScript
25
+ import static groovy.test.GroovyAssert.isAtLeastJdk
25
26
import static groovy.test.GroovyAssert.shouldFail
26
27
27
28
/**
@@ -108,7 +109,10 @@ final class ImmutableTransformTest {
108
109
109
110
@Test
110
111
void testCloneableFieldNotCloneableObject () {
111
- shouldFail CloneNotSupportedException , ''' import groovy.transform.*
112
+ // attempting to access the protected clone() method is illegal from JDK16
113
+ def expectedException = isAtLeastJdk(' 16.0' ) ? IllegalAccessException : CloneNotSupportedException
114
+ shouldFail expectedException, '''
115
+ import groovy.transform.*
112
116
class Dolly {
113
117
String name
114
118
}
@@ -125,7 +129,8 @@ final class ImmutableTransformTest {
125
129
126
130
@Test
127
131
void testImmutableListProp () {
128
- def objects = new GroovyShell (). evaluate ''' import groovy.transform.*
132
+ def objects = new GroovyShell (). evaluate '''
133
+ import groovy.transform.*
129
134
@Immutable class HasList {
130
135
char[] letters
131
136
List numbers
You can’t perform that action at this time.
0 commit comments