简体   繁体   English

如何在findbugs中排除构造函数?

[英]How to exclude a constructor in findbugs?

I can exclude a regular method like this in my findbugs-exclude.xml: 我可以在findbugs-exclude.xml中排除这样的常规方法:

<Match>
    <Class name="com.my.package.MyClass"/>
    <Method name="calculateSomeValue"/>
    <Bug pattern="CLI_CONSTANT_LIST_INDEX"/>
</Match>

But what if I want to ignore the bug pattern being flagged in a constructor? 但是如果我想忽略在构造函数中标记的错误模式呢?

I've tried 我试过了

<Method name="MyClass"/>

and

<Method name="new"/>

which don't seem to work. 这似乎不起作用。

MyClass only defines one constructor. MyClass只定义了一个构造函数。

您必须将此代码用于排除构造函数

<Method name="&lt;init&gt;"/>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM