Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/321.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Checkstyle-要抑制的警告的白名单_Java_Checkstyle_Suppress Warnings - Fatal编程技术网

Java Checkstyle-要抑制的警告的白名单

Java Checkstyle-要抑制的警告的白名单,java,checkstyle,suppress-warnings,Java,Checkstyle,Suppress Warnings,通过检查,我可以指定哪些警告不能被抑制。因此,为了不允许取消选中抑制: <module name="SuppressWarnings"> <property name="format" value="^unchecked$"/> </module> 但是它不起作用(它既不检测未选中的也不检测任何其他抑制)。如前所述,通过如下配置检查,您可以使用正则表达式来匹配除未选中的之外的任何内容: 这个正则表达式构造称为“零宽度负前瞻”。使用起来有点笨拙;如果C

通过检查,我可以指定哪些警告不能被抑制。因此,为了不允许
取消选中
抑制:

<module name="SuppressWarnings">
  <property name="format" value="^unchecked$"/>
</module>
但是它不起作用(它既不检测
未选中的
也不检测任何其他抑制)。

如前所述,通过如下配置检查,您可以使用正则表达式来匹配除
未选中的
之外的任何内容:



这个正则表达式构造称为“零宽度负前瞻”。使用起来有点笨拙;如果Checkstyle包含一个选项来配置您想要的是白名单还是黑名单会更好。但是,这也很有效。

我需要同时允许
取消选中
nls
抑制,所以我使用
^(?(取消选中)|(nls)).$
模式。非常感谢。
<module name="SuppressWarnings">
  <property name="format" value="[^(unchecked)]"/>
</module>