如何忽略具有特定注释的方法的 checkstyle javadoc 警告 [英] How to Ignore checkstyle javadoc warning for a method with a specific annotation
问题描述
当我有一个没有 javadoc 的公共方法时,Checkstyle 会发出警告,这很好!当我覆盖一个公共方法时,我没有收到警告,因为 javadoc 在该方法的父类中已经可用.
现在我的方法有另一个注释,例如 @MyEvent
.现在我确实收到了警告但不想要它,因为注释说得够多了.我可以排除带有特定注释的方法的警告吗?
有一些解决方案涉及向我的代码添加内容,例如 @SuppressWarnings
或诸如 //CHECKSTYLE.OFF
之类的注释,但这并没有使我的代码更好,我可以而只是添加javadoc.所以我正在寻找一个配置级别的解决方案.
我可以排除带有特定注释的方法的警告吗?
您可以使用一种特定的注释(@SuppressWarnings
)来抑制警告,但不能使用其他注释(例如 @MyEvent
)来达到这种效果..>
至少不是开箱即用的.如果你愿意做一些编程,你可以开发自己的自定义过滤器来满足你的需求.
Checkstyle warns when I have a public method without javadoc, which is nice! When I override a public method I don't get the warning because the javadoc is already available in the parent class for the method.
Now I have an other annotation for my method for example @MyEvent
. Now I do get the warning but don't want it because the annotation says enough. Can I exclude warnings for methods with a specific annotation?
There are some solutions that involve adding stuff to my code like @SuppressWarnings
or comments like // CHECKSTYLE.OFF
but this does not make my code nicer, i could instead just add the javadoc. So I'm looking for a configuration level solution.
Can I exclude warnings for methods with a specific annotation?
You can suppress warnings by using one specific annotation (@SuppressWarnings
), but other annotations can not be used to that effect (such as @MyEvent
).
At least not out of the box. If you are willing to do some programming, you can develop your own custom filter that does what you need.
这篇关于如何忽略具有特定注释的方法的 checkstyle javadoc 警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!