简体   繁体   English

JSR 305的状态如何?

[英]What is the status of JSR 305?

I have seen the question JSR305 vs. JSR308 (Java Type Anotations) - Which is going to be the standard? 我已经看到了JSR305与JSR308(Java类型注释)的问题-哪个将成为标准? and I understand the difference between JSR 308 and JSR 305 . 而且我了解JSR 308JSR 305之间的区别。

I also understand that, at this time, 308 is slated for Java 7, and 305 is not, and I am curious about the overall status of 305. 我还了解到,此时Java 308的版本是308,而305不是。我对305的整体状态感到好奇。

Specifically, I am using Google Collections and JSR-305 in some of my projects (in a similar manner to what one of the Guice best practices advocates ) and was wondering if there is a more "future direction"-friendly approach I should be using instead. 具体来说,我在某些项目中使用了Google CollectionsJSR-305与Guice最佳实践的倡导者所采用的方式类似),并且想知道我是否应该使用更“面向未来”的方法代替。 I am planning to also ask about this on the JSR-305 group, but that group does not have much activity and I was just wondering if anyone here had any more info. 我打算在JSR-305小组上也询问这个问题,但是该小组没有太多活动,我只是想知道这里是否有人有更多信息。

As described in this answer , JSR-305 proposes new annotations such as @NonNull , while JSR-308 proposes allowing annotations in new places such as on generic declarations. 如此答案中所述JSR-305提出了新的注释,例如@NonNull ,而JSR-308提出了允许在新位置(例如,通用声明)上进行注释。

Quoting JSR 308 page: 引用JSR 308页面:

…this document does not propose any annotations, merely specifying where they can appear in Java code. …该文档没有提出任何注释,仅指定了它们可以在Java代码中出现的位置。

JSR 308 (annotations in new places) is included in java 8 under JEP 104 . JEP 104下的Java 8中包含JSR 308(新位置的注释)。

As of 2017, JSR 305 (new annotations) continues to carry official status of “Dormant”. 截至2017年, JSR 305 (新注释)继续保持“休眠”状态。 A question about it's status in the google group has been unanswered since 2010. 自2010年以来,有关其在Google网上论坛中的状态的问题一直未得到解答。

There is a reference implementation of the JSR-305 annotations here which is used by many projects, including guava. 还有就是JSR-305注释的参考实现这里所使用的许多项目,包括番石榴。 With maven you can use the JSR-305 reference implementation by adding this to your pom: 使用maven,可以通过将JSR-305参考实现添加到pom中来使用它:

<dependency>
    <groupId>com.google.code.findbugs</groupId>
    <artifactId>jsr305</artifactId>
    <version>3.0.0</version>
</dependency>

JSR 305 will not be part of Java 8: JSR 305将不属于Java 8:

Java 8 is described by JSR 337: the specification has reached Final status: see here . JSR 337描述了Java 8:规范已达到最终状态: 参见此处

  • JSR 308 is definitely in JSR 308肯定在
  • JSR 305 is definitely out JSR 305肯定已经淘汰

根据Alex Millers Java 7博客 ,JSR-308(和305)计划加入Java7。也许他会出现在这里,并为您提供更多信息。

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

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