admin管理员组

文章数量:1794759

测试时出现警告:WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective acc

测试时出现警告:WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective acc

问题描述

今天在运行一个功能的测试用例的时候,出现了如下警告:

WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by org.codehaus.groovy.vmplugin.v9.Java9 (file:/C:/Users/26808/.m2/repository/org/codehaus/groovy/groovy/3.0.9/groovy-3.0.9.jar) to field java.util.ArrayList.size WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.vmplugin.v9.Java9 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

翻译如下

警告:发生了非法的反射访问操作 警告:非法反射访问来自: org.codehaus.groovy.vmplugin.v9.Java9 (file:/C:/Users/26808/.m2/repository/org/codehaus/groovy/groovy/3.0.9/groovy-3.0.9.jar) to field java.util.ArrayList.size 警告:请考虑将此报告给org.apache.ibatis.reflection.Reflector 警告:User --ilgal access = 警告以启用有关进一步的非法反射访问操作的警告 警告:在将来的版本中,所有非法访问操作都将被拒绝
原因分析:

推测可能是jdk版本过高,我这里用的是jdk11版本的,不过这个警告对于项目没啥影响,不会影响项目的正常运行。


解决方案:

将jdk版本切换到1.8即可解决。 操作步骤:进入idea项目结构设置(快捷键:Ctrl+Alt+Shift+S)

本文标签: 测试illegalreflectiveAccesswarning