Groovy - WARNING: An illegal reflective access operation has occurred

an illegal reflective access operation has occurred maven
an illegal reflective access operation has occurred intellij
an illegal reflective access operation has occurred spring
an illegal reflective access operation has occurred mockito
groovy_turn_off_java_warnings
warning: an illegal reflective access operation has occurred sonarqube
warning an illegal reflective access operation has occurred postgres
warning: an illegal reflective access operation has occurred hadoop

I am pretty much new to java and groovy. I have installed groovy 3.0 on my windows 10 laptop (64 bit) and when tried to run groovy getting following warning:

>groovy -v
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.reflection.CachedClass (file:/C:/groovy-3.0.0-alpha-1/lib/groovy-3.0.0-alpha-1.jar) to method java.lang.Object.finalize()
WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.reflection.CachedClass
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Groovy Version: 3.0.0-alpha-1 JVM: 9.0.1 Vendor: Oracle Corporation OS: Windows 10

And the java version is:

java --version
java 9.0.1
Java(TM) SE Runtime Environment (build 9.0.1+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode)

Any help to resolve this.

It is more than a 'warning' for me: I cannot get Groovy scripts to run (on macOS) with the current JVM 9, much less 10. The workaround (until a compatible version of Groovy is available) is to install jenv and an earlier version of Java, so you can switch when needed.

An illegal reflective access operation has occurred when using Java , WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by org.codehaus.groovy.vmplugin.v7. GROOVY-8918 Illegal Reflective Access reported during Gradle build Closed GROOVY-9066 An illegal reflective access operation has occurred - on groovysh / Groovy 3.0.0-alpha-4 on Win 10 with JDK 11 (all 64 bit)

To disable the warnings you can pass --add-opens to the JVM, see details here. Unfortunately Groovy requires a lot of modules/packages to be opened, see this (currently reverted) commit (source). Just tested these with AdoptOpenJDK 11.

WARNING: An illegal reflective access operation has occurred , [INFO] Using Groovy-Eclipse compiler to compile both Java and Groovy files WARNING: An illegal reflective access operation has occurred  GROOVY-9217 Fix warning "An illegal reflective access operation has occurred" when setting property. Closed; links to. GitHub Pull Request #934. Activity. People.

Although my environment is Linux, after struggling some days to setup Groovy on Grails environment I feel like I know the answer: use JDK 8 for now. I was fiddling with JDK 9, and I thought it was too far behind so I tried JDK 11, which made things even worse, I got actual crashes. It seems like that Groovy / Grails is heavily lagging behind in terms of Java version compatibility.

Once the new Groovy will be released (said to be end of this year) then newer JDK can be used as well.

Groovy warnings if running/baking with JDK11, Groovy warnings if running/baking with JDK11 - illegal reflective access operation has occurred #604. Open. ottlinger opened this issue on May  An illegal reflective access operation has occurred - on groovysh / Groovy 3.0.0-alpha-4 on Win 10 with JDK 11 (all 64 bit) Reproduction steps: 1) On Win 10 (64bit) 2) Install JDK 11 (64bit) ( verify it was referenced succesfully - CDM > java -version

Groovy, It is more than a 'warning' for me: I cannot get Groovy scripts to run (on macOS) with the current JVM 9, much less 10. The workaround (until a  Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes.

Why groovy shows warning "An illegal reflective access operation , When I use JDK11, and then installed Groovy, some warning occurred like below​: WARNING: An illegal reflective access operation has  The linked ticket contains a workaround, but not really a solution. The real issue is a problem in the JDK. There is actually no illegal access, but the JDK method trySetAccessible is misbehaving. This will hopefully be fixed in a future JDK version. This comment has been minimized. Sign in to view. bw-smarkwell commented on Dec 29, 2017.

Removing illegal reflective access warnings in Grails 4, WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by org.codehaus.groovy.reflection. WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.reflection.CachedClass$3$1. is a JDK9+ way of warning you about illegal reflective access, and it couldn't have read anything more appropriate than "consider reporting this to the maintainers of org.codehaus.groovy.reflection.CachedClass".

Comments
  • It's not an error, it's a warning. Won't hurt you.
  • Does it works without any issues going forward ? Is there any way to sort out this ?
  • It'll cause issues at some point in the future, but not yet. As the message says, you can report this to the library maintainers... if you're using the latest version, and a bug report doesn't already exist.
  • Groovy is having to undergo significant changes to accommodate the Java 9 module system; this is why the version is labeled alpha-1. If you're new to Groovy and Java, start with Groovy 2.4 (and probably Java 8) to get acquainted before dealing with modules.
  • I hope it may be ignored for now because it is warning nor error. Please se upstream bugreport for that: issues.apache.org/jira/browse/GROOVY-8339