Re: Illegal reflective access (ArrayList.size) – F ixed in any Groovy 3.x/4.x version?

Paul King <[email protected]> Tue, 24 Feb 2026 20:58:17 +1000
Newsgroups gmane.comp.lang.groovy.user
Message-ID <CAMbkE7RkvfCbh460XeBcaUNDnie3awBY3aLc4dXbE9j19a=d4Q@mail.gmail.com>
Hi Anjan,

Do you see a stacktrace if you set the illegal-access flag to debug or deny=
?
E.g. if using Maven:

export MAVEN_OPTS=3D"--illegal-access=3Ddebug"

This is expected behavior if you are calling the size property (since
that's a private field) on a list. Older versions of Groovy might
mistakenly call that. If we can narrow down what is calling that, we
can tell you if a later version of Groovy fixes it. If it is in your
code, then it is behaving as expected. Failing that, do you have a
reproducer?

In general, if you want to stick to JDK11, you might need to use --add-open=
s.

Cheers, Paul.

On Fri, Feb 20, 2026 at 4:47=E2=80=AFPM Anjan Baradwaj via users
<users-GSC0n/0aZo1d/SJB6HiN2Ni2O/[email protected]> wrote:
>
> Hello Groovy Team,
>
> We are using Groovy 3.0.12 with JDK 11 and see the following warning
> WARNING: An illegal reflective access operation has occurred
> WARNING: Illegal reflective access by org.codehaus.groovy.vmplugin.v9.Jav=
a9
> (file: .../groovy-3.0.12.jar) to field java.util.ArrayList.size
> WARNING: Please consider reporting this to the maintainers of org.codehau=
s.groovy.vmplugin.v9.Java9
> WARNING: All illegal access operations will be denied in a future release
>
> We also tested with Groovy 4.x and observed similar behavior.
>
> Environment details:
>
> Groovy: 3.0.12 (also tested 4.x)
> Java: 11.0.29
> Maven: 3.5.2
>
> Could you please let us know:
>
> Has this been fixed in any newer Groovy 3.x or 4.x version?
> If yes, which version should we upgrade to?
> Is there any recommended approach to avoid this without using --add-opens=
 JVM options?
>
>
> Thank you for your help.
>
> Best regards,
> Anjan
>
> CONFIDENTIALITY NOTICE: The information contained in this electronic mess=
age is intended to be viewed only by the individual or entity to which it i=
s addressed. It may contain information that is privileged, confidential, a=
nd exempt from disclosure under applicable law. If the reader of this messa=
ge is not the intended recipient, you are hereby notified that any dissemin=
ation, distribution or duplication of this message is strictly prohibited. =
If this electronic message has been received in error, please notify sender=
 immediately by return email and delete the original message and any copies=
 of it from your computer system. Thank you.