illegal reflective access operation: AccessibilityChanger
See original GitHub issueHi.
I’m using IntelliJ Community 2017.3 and when I run junit tests using “Menu>Run>Run All In Owner” in my project (https://github.com/lviggiano/owner/) I get the following warning at the console:
/Library/Java/JavaVirtualMachines/jdk-9.0.1.jdk/Contents/Home/bin/java -ea -Didea.test.cyclic.buffer.size=1048576 "-javaagent:/Applications/IntelliJ IDEA CE.app/Contents/lib/idea_rt.jar=51785:/Applications/IntelliJ IDEA CE.app/Contents/bin" -Dfile.encoding=UTF-8 -classpath "/Applications/IntelliJ IDEA CE.app/Contents/lib/idea_rt.jar:/Applications/IntelliJ IDEA CE.app/Contents/plugins/junit/lib/junit-rt.jar:/Applications/IntelliJ IDEA CE.app/Contents/plugins/junit/lib/junit5-rt.jar:/Users/luigi/var/src/owner/owner/target/test-classes:/Users/luigi/var/src/owner/owner/target/classes:/Users/luigi/.m2/repository/org/hamcrest/hamcrest-all/1.3/hamcrest-all-1.3.jar:/Users/luigi/.m2/repository/junit/junit/4.12/junit-4.12.jar:/Users/luigi/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar:/Users/luigi/.m2/repository/org/mockito/mockito-core/2.15.0/mockito-core-2.15.0.jar:/Users/luigi/.m2/repository/net/bytebuddy/byte-buddy/1.7.9/byte-buddy-1.7.9.jar:/Users/luigi/.m2/repository/net/bytebuddy/byte-buddy-agent/1.7.9/byte-buddy-agent-1.7.9.jar:/Users/luigi/.m2/repository/org/objenesis/objenesis/2.6/objenesis-2.6.jar:/Users/luigi/.m2/repository/commons-codec/commons-codec/1.11/commons-codec-1.11.jar" com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 @w@/private/var/folders/yx/d_5sbt_j7ns2x62q3x_7lcgr0000gn/T/idea_working_dirs_junit.tmp @/private/var/folders/yx/d_5sbt_j7ns2x62q3x_7lcgr0000gn/T/idea_junit.tmp -socket51784
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.mockito.internal.util.reflection.AccessibilityChanger (file:/Users/luigi/.m2/repository/org/mockito/mockito-core/2.15.0/mockito-core-2.15.0.jar) to field java.util.Properties.defaults
WARNING: Please consider reporting this to the maintainers of org.mockito.internal.util.reflection.AccessibilityChanger
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
Process finished with exit code 0
I cannot identify the problematic test, since I have hundreds and this happens when I run them all at once. But eventually if I find the problematic one, I’ll update this issue.
I’m using mockito-core 2.15.0; java 9.0.1, Maven 3.3.9, Mac OS X 10.13.3
/Library/Java/JavaVirtualMachines/jdk-9.0.1.jdk/Contents/Home/bin/java -Dmaven.multiModuleProjectDirectory=/Users/luigi/var/src/owner "-Dmaven.home=/Applications/IntelliJ IDEA CE.app/Contents/plugins/maven/lib/maven3" "-Dclassworlds.conf=/Applications/IntelliJ IDEA CE.app/Contents/plugins/maven/lib/maven3/bin/m2.conf" "-javaagent:/Applications/IntelliJ IDEA CE.app/Contents/lib/idea_rt.jar=51962:/Applications/IntelliJ IDEA CE.app/Contents/bin" -Dfile.encoding=UTF-8 -classpath "/Applications/IntelliJ IDEA CE.app/Contents/plugins/maven/lib/maven3/boot/plexus-classworlds-2.5.2.jar" org.codehaus.classworlds.Launcher -Didea.version=2017.3.4 -version
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T17:41:47+01:00)
Maven home: /Applications/IntelliJ IDEA CE.app/Contents/plugins/maven/lib/maven3
Java version: 9.0.1, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk-9.0.1.jdk/Contents/Home
Default locale: en_IT, platform encoding: UTF-8
OS name: "mac os x", version: "10.13.3", arch: "x86_64", family: "mac"
Process finished with exit code 0
Thanks & Best regards, L.
Issue Analytics
- State:
- Created 6 years ago
- Comments:36 (8 by maintainers)
Top Results From Across the Web
Java 9 Illegal Reflective Access Warning - Baeldung
Before Java 9, the Java Reflection API has a superpower: It could gain access to the non-public class members without limitation.
Read more >How to use reflection with Mockito mock objects - Stack Overflow
I'm trying to test some Java code that uses reflection, ... WARNING: An illegal reflective access operation has occurred WARNING: Illegal ...
Read more >What to do about "illegal reflective access" - Google Groups
WARNING: An illegal reflective access operation has occurred. WARNING: Illegal reflective access by org.mockito.internal.util.reflection.
Read more >An illegal reflective access operation has occurred when ...
You will see An illegal reflective access operation has occurred warning when installing and using AM (including Amster and ssoadm tools), Java ...
Read more >Warning an illegal reflective access operation has occurred in ...
Search for jobs related to Warning an illegal reflective access operation has occurred in selenium or hire on the world's largest freelancing marketplace ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi,
Found another similar issue running OpenJDK 11:
In my case, changing the dependency from
mockito-all:2.0.2-beta
tomockito-core:3.2.4
solved the problem