当前位置:   article > 正文

报错解决:Options-Xverify-none-and-noverify-were-deprecated-in-JDK-13......(20201128补充:和JVM类加载机制中的验证机制有关)_-xverify:none

-xverify:none

问题描述

使用idea启动一个SpringBoot项目的时候,控制台出现了如下的警告⚠️:

Java HotSpot(TM) 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release.
  • 1

错误分析

我的jdk版本为15SpringBoot版本为2.3.5.RELEASE

参考JDK 13 Release Notes

在jdk13及以后的版本中弃用这些选项有助于防止用户运行违反JVM规范的代码,这会使他们的应用程序容易受到恶意代码的攻击,所以jdk版本在13以前的是没有这个警告的,这个警告来源于13及以后的一个版本设置问题。
(2020年11月28日)补充:今天刚好在看JVM的类加载过程。-Xverify:none这个设置和链接过程中的验证阶段有关,这个设置可以关闭大部分类的类验证措施,以缩短虚拟机的类加载时间。当然啦如果这个程序已经被反复编译过,说明其实也没由太大的毛病了,所以也不太需要这个验证了。但是官方在jdk13中废弃了这个选项显然还是出于对Java虚拟机安全方面的考虑。

Deprecated Java Options -Xverifynone and -noverify

The Java options -Xverify:none and -noverify have been deprecated in this release. The options will continue to work as intended but will generate the following warning when used:

warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release.
  • 1

Deprecating these options helps prevent users from running code that violates the JVM Specification, which can leave their applications open to malicious code.

Users who need to run without startup verification can use AppCDS to archive their classes. The classes are verified during archiving and avoid verification at runtime.

Note that if you encounter issues while using either of these options, it is very likely that you will be required to reproduce the problem without using these options before Oracle Support can assist with an investigation.

解决措施

参考OpenJDK 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release

以下为idea中的操作:

image-20201127164535981

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/木道寻08/article/detail/941238
推荐阅读
相关标签
  

闽ICP备14008679号