eclipse 不支持的@SuppressWarnings("PMD.DoNotCallSystemExit")

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5017569/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 15:48:15  来源:igfitidea点击:

Unsupported @SuppressWarnings("PMD.DoNotCallSystemExit")

eclipsepmdsuppress-warningssystemexit

提问by user342495

I need to use System.exit(0)in an application. Eclipse has the PMD plugin installed and complains about this line of code. Adding @SuppressWarnings ("PMD.DoNotCallSystemExit")remove that warning but now I get a warning that this SuppressWarningsis unsupported, despite the fact that it works.

我需要System.exit(0)在应用程序中使用。Eclipse 安装了 PMD 插件并抱怨这行代码。添加@SuppressWarnings ("PMD.DoNotCallSystemExit")删除该警告,但现在我收到一个警告,指出这SuppressWarnings是不受支持的,尽管它确实有效。

Is there a way to resolve this?

有没有办法解决这个问题?

回答by user342495

To get Eclipse to not flag the @SuppressWarnings("PMD")annotation, look under the menu headings Java -> Compiler -> Errors/Warnings -> Annotations -> Unhandled Token in '@SuppressWarnings' and set it to ignore.

要让 Eclipse 不标记@SuppressWarnings("PMD")注释,请查看菜单标题 Java -> Compiler -> Errors/Warnings -> Annotations -> Unhandled Token in '@SuppressWarnings' 并将其设置为忽略。

Right on the PMDpage.

就在PMD页面上。