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

54

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

是否有解决方法?


请为此错误修复投票:https://bugs.eclipse.org/bugs/show_bug.cgi?id=392045 - Stefan
1个回答

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

12
这种方法的缺点是Eclipse不会报告任何不支持的标记,如此报道称,列表是硬编码的:http://www.coderjunk.com/0JJqegPVWj/how-to-add-custom-suppresswarnings-token-in-eclipse.html。 - Nicolas
13
Eclipse项目有一个错误报告:欢迎支持该问题:https://bugs.eclipse.org/bugs/show_bug.cgi?id=392045 - Sebien

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接