[ https://issues.apache.org/jira/browse/GROOVY-8339?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16189538#comment-16189538 ]
Paul King edited comment on GROOVY-8339 at 10/3/17 10:51 AM: ------------------------------------------------------------- That warning is to be expected on all currently released versions of Groovy under JDK9. The operation we are doing is perfectly legal under JDK8 and earlier and represents correctly working code. It just doesn't confirm to the new rules imposed by the Java 9 module system. It won't affect program use under JDK9. In unreleased versions of Groovy, we have a temporary workaround to avoid the warnings involving setting an environment property flag but this doesn't apply to using Groovy in an embedded mode like from Gradle. You could adopt the same approach it uses (involves --add-opens and --add-modules) but it would involve some hackery on your part. There are other nasty hacks to get around the warning but I don't recommend them: https://stackoverflow.com/questions/46454995/how-to-hide-warning-illegal-reflective-access-in-java-9-without-jvm-argument Longer term we are looking at reworking affected parts of Groovy but it will take some time. If you don't want to hush the warnings using the --add-opens/--add-modules hack above, I'd just ignore the errors for now. was (Author: paulk): That warning is to be expected on all currently released versions of Groovy. The operation we are doing is perfectly legal under JDK8 and earlier and represents correctly working code. It just doesn't confirm to the new rules imposed by the Java 9 module system. It won't affect program use under JDK9. In unreleased versions of Groovy, we have a temporary workaround to avoid the warnings involving setting an environment property flag but this doesn't apply to using Groovy in an embedded mode like from Gradle. You could adopt the same approach it uses (involves --add-opens and --add-modules) but it would involve some hackery on your part. There are other nasty hacks to get around the warning but I don't recommend them: https://stackoverflow.com/questions/46454995/how-to-hide-warning-illegal-reflective-access-in-java-9-without-jvm-argument Longer term we are looking at reworking affected parts of Groovy but it will take some time. If you don't want to hush the warnings using the --add-opens/--add-modules hack above, I'd just ignore the errors for now. > Fix warning "An illegal reflective access operation has occurred" > ----------------------------------------------------------------- > > Key: GROOVY-8339 > URL: https://issues.apache.org/jira/browse/GROOVY-8339 > Project: Groovy > Issue Type: Improvement > Components: groovy-jdk > Affects Versions: 2.4.11 > Environment: >gradle --version > Gradle 4.2 > Build time: 2017-09-20 14:48:23 UTC > Revision: 5ba503cc17748671c83ce35d7da1cffd6e24dfbd > Groovy: 2.4.11 > Ant: Apache Ant(TM) version 1.9.6 compiled on June 29 2015 > JVM: 9 (Oracle Corporation 9+181) > OS: Windows 10 10.0 amd64 > Reporter: Benjamin Roedell > Priority: Minor > Labels: newbie, security > > I'm running JDK-9 on Windows 10 with Gradle 4.2. > My global gradle.properties file contains the following line: > org.gradle.java.home=C:/Program Files/Java/jdk-9 > When I request the gradle version (gradle --version) I get the following > warning: > {code:none} > WARNING: An illegal reflective access operation has occurred > WARNING: Illegal reflective access by > org.codehaus.groovy.reflection.CachedClass > (file:/C:/Program%20Files/gradle-4.2/lib/groovy-all-2.4.11.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 > {code} > This warning displayed regardless of whether I'm using a regular command > prompt or an elevated rights (Administrator) command prompt. > Here's the full command and output: > {code:none} > gradle --version > WARNING: An illegal reflective access operation has occurred > WARNING: Illegal reflective access by > org.codehaus.groovy.reflection.CachedClass > (file:/C:/Program%20Files/gradle-4.2/lib/groovy-all-2.4.11.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 > ------------------------------------------------------------ > Gradle 4.2 > ------------------------------------------------------------ > Build time: 2017-09-20 14:48:23 UTC > Revision: 5ba503cc17748671c83ce35d7da1cffd6e24dfbd > Groovy: 2.4.11 > Ant: Apache Ant(TM) version 1.9.6 compiled on June 29 2015 > JVM: 9 (Oracle Corporation 9+181) > OS: Windows 10 10.0 amd64 > {code} -- This message was sent by Atlassian JIRA (v6.4.14#64029)