如何忽略具有特定注释的方法的Checkstyle的javadoc警告 [英] How to Ignore checkstyle javadoc warning for a method with a specific annotation

查看:3190
本文介绍了如何忽略具有特定注释的方法的Checkstyle的javadoc警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我有没有javadoc的一个公共方法,这是很好的Checkstyle警告!当我重写一个公共的方法,因为的Javadoc已经在该方法的父类可我不明白的警告。

现在我有其他的注释为我的例如方法 @MyEvent 。现在,我得到了警告,但由于注释说够不想要它。我可以排除方法警告与特定的注解?

有一些解决方案,涉及添加的东西到我的code像 @燮pressWarnings 或类似 // CHECKSTYLE意见。关闭但是,这并不让我的code更好,我可以而不只是添加的Javadoc。所以,我在找一个配置级别的解决方案。


解决方案

  

我可以排除警告与特定注释的方法呢?


您可以通过使用一个特定的注解燮preSS警告( @燮pressWarnings ),但其他注释不能使用这种效果(如为 @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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆