Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Groovy JDK 11 disable the WARNING message

Tags:

java-11

groovy

When I run Groovy 2.5.3 on JDK 11 its giving warning message:

groovy -e 'print "hi"' WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by org.codehaus.groovy.vmplugin.v7.Java7$1 (file:/home/user/.sdkman/candidates/groovy/current/lib/groovy-2.5.3.jar) to constructor java.lang.invoke.MethodHandles$Lookup(java.lang.Class,int) WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.vmplugin.v7.Java7$1 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 

Is there an option to disable this warning message?

like image 662
sfgroups Avatar asked Oct 22 '18 13:10

sfgroups


Video Answer


2 Answers

You can disable the Java warnings with GROOVY_TURN_OFF_JAVA_WARNINGS as a temporary fix:

$ GROOVY_TURN_OFF_JAVA_WARNINGS=true groovy -e 'print "hi\n"' hi 
like image 154
kba Avatar answered Sep 21 '22 10:09

kba


The current stable version 3.0.x of Groovy is reported to fix this issue, see GROOVY-8339 for the detailed discussion.

like image 34
centic Avatar answered Sep 21 '22 10:09

centic