我试图看看为什么我会收到“警告:发生了非法反射访问操作”我想在此之前摆脱那些警告我想检查它在我的代码中实际发生的位置。因为我读过
“对任何此类包的第一次反射访问操作会导致发出警告,但在那之后不会发出警告。这个单一警告描述了如何启用进一步的警告。这个警告不能被抑制。”
所以要得到进一步的警告
所以我在 IntelliJ 中提到了 --illegal-access=deny 和 --add-exports 选项。
<option name="ADDITIONAL_OPTIONS_OVERRIDE">
<module name="XXX" options="--illegal-access=deny --add-exports=java.base/sun.net.www.protocol.http=ALL-UNNAMED" />
</option>
然后我得到了 Error:java: error: invalid flag: --illegal-access=deny
这些是警告
WARNING: Illegal reflective access by com.thoughtworks.xstream.core.util.Fields (file:xxx/xxx/xxx/xstream-1.4.10.jar) to field java.util.TreeMap.comparator
WARNING: Please consider reporting this to the maintainers of com.thoughtworks.xstream.core.util.Fields
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations