Thanks, Paul, for the suggestion.

I was able to isolate the cause from the stacktrace and then address it using 
the "list.size()" method call in place of calling the size property.

I will keep an eye open for any other calls which maybe throwing the warning.

Best,
Anjan


________________________________
From: Paul King <[email protected]>
Sent: Tuesday, February 24, 2026 4:28 PM
To: [email protected] <[email protected]>
Subject: Re: Illegal reflective access (ArrayList.size) – Fixed in any Groovy 
3.x/4.x version?

CAUTION: This email originated from outside of the organization. Do not click 
links or open attachments unless you recognize the sender and know the content 
is safe.


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="--illegal-access=debug"

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-opens.

Cheers, Paul.

On Fri, Feb 20, 2026 at 4:47 PM Anjan Baradwaj via users
<[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.Java9
> (file: .../groovy-3.0.12.jar) to field java.util.ArrayList.size
> WARNING: Please consider reporting this to the maintainers of 
> org.codehaus.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 message 
> is intended to be viewed only by the individual or entity to which it is 
> addressed. It may contain information that is privileged, confidential, and 
> exempt from disclosure under applicable law. If the reader of this message is 
> not the intended recipient, you are hereby notified that any dissemination, 
> 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.
CONFIDENTIALITY NOTICE: The information contained in this electronic message is 
intended to be viewed only by the individual or entity to which it is 
addressed. It may contain information that is privileged, confidential, and 
exempt from disclosure under applicable law. If the reader of this message is 
not the intended recipient, you are hereby notified that any dissemination, 
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.

Reply via email to