德$ P $在FindBugs的2.0 pcated注解 [英] Deprecated annotations in FindBugs 2.0

查看:197
本文介绍了德$ P $在FindBugs的2.0 pcated注解的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

综观FindBugs的注释的列表2.0 ,我看到很多人都已经去precated。

Looking at the list of annotations in FindBugs 2.0, I see that a lot of them have been deprecated.

一些的( @CheckForNull @NonNull 等)已经pcated因为德$ P $它们具有等效的JSR-305注释。好,终于解决哪些设置注释使用的窘境。

Some of these (@CheckForNull, @NonNull, etc.) have been deprecated because they have equivalent JSR-305 annotations. Good to finally settle the dilemma about which set of annotations to use.

但一些FindBugs的具体注释,如 @DefaultAnnotation @DefaultAnnotationForFields ,也已经去precated,我无法找到自己的位置如何使用任何解释。我试图迁移codeBase的,使得大量使用这些注解,而我有点卡住了。

But some FindBugs-specific annotations, such as @DefaultAnnotation and @DefaultAnnotationForFields, have also been deprecated and I cannot find any explanation of what to use in their place. I'm trying to migrate a codebase that makes heavy use of these annotations, and I'm a bit stuck.

我看到JSR-305具有 @ParametersAreNonnullByDefault ,我可以用它来替换 @DefaultAnnotationForParameters 的某些实例,但不会涵盖所有情况。

I see that JSR-305 has @ParametersAreNonnullByDefault, which I could use to replace some instances of @DefaultAnnotationForParameters, but that will not cover all cases.

我失去了一些大吗?我应该使用的注释,而不是某种设置文件之类的东西,?

Am I missing something big here? Should I be using some kind of settings file or something, instead of annotations?

推荐答案

(注:见Should在jar305.jar注解来preferred过类似的注释中annotation.jar为FindBugs的?)

从笔者的PDF(这里),第51页:

From the author's PDF (here), on page 51:

JSR-305将只定义 ParametersAreNonnullByDefault
  但更多的可以JSR-305的外部定义

JSR-305 will only define ParametersAreNonnullByDefault, but more can be defined outside of JSR-305

•并且可以是静态分析器PTED间$ P $
  国米preT JSR-305的注释

• and can be interpreted by static analyzers that interpret JSR-305 annotations

...所以基本上你可以自己定义它,并给它相同的名称,您要更换的之一,它最终应该工作正常,因为FindBugs的只能运行通过名称注释(可能prefers的JSR-305的注释,可能是由于特别是德precation)。

...so basically you can define it yourself, and give it the same name as the one you're replacing, and it should end up working fine since FindBugs only runs annotations by name (and likely prefers the JSR-305 annotations, maybe due to the deprecation in particular).

举一个例子,<一个href=\"http://$c$c.google.com/p/jsr-305/source/browse/trunk/ri/src/main/java/javax/annotation/ParametersAreNonnullByDefault.java?r=31\">here正源 @ParametersAreNonnullByDefault

有关详细信息,您可能需要通过电子邮件发送JSR-305和的FindBugs作者:比尔·普格(这里是他的网站)。此外,该问题已经被添加到Sourceforge的bug跟踪系统(<一个href=\"https://sourceforge.net/tracker/?func=detail&aid=3483864&group_id=96405&atid=614693\">here).

For more information, you might need to email the author of JSR-305 and FindBugs: Bill Pugh (here is his website). Also, the issue has been added to the Sourceforge bug tracker (here).

这篇关于德$ P $在FindBugs的2.0 pcated注解的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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