Java JSR 305 的状态是什么?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2289694/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-13 05:43:13  来源:igfitidea点击:

What is the status of JSR 305?

javajsr305

提问by Charlie Collins

I have seen the question JSR305 vs. JSR308 (Java Type Anotations) - Which is going to be the standard?and I understand the difference between JSR 308and JSR 305.

我已经看到了JSR305 与 JSR308(Java 类型注释)的问题——哪个将成为标准?我了解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.

我也了解到,此时 308 是为 Java 7 指定的,而 305 不是,我很好奇 305 的整体状态。

Specifically, I am using Google Collectionsand JSR-305in 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. 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.

具体来说,我在我的一些项目中使用了Google CollectionsJSR-305(以类似于Guice 最佳实践所倡导的方式),并且想知道是否应该使用一种更“未来方向”友好的方法反而。我也打算在 JSR-305 组上询问这个问题,但该组没有太多活动,我只是想知道这里是否有人有更多信息。

采纳答案by sbridges

As described in this answer, JSR-305proposes new annotations such as @NonNull, while JSR-308proposes allowing annotations in new places such as on generic declarations.

如本答案所述JSR-305提出了新的注释,例如@NonNull,而JSR-308提议允许在新的位置(例如泛型声明)进行注释。

Quoting JSR 308page:

引用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 8under JEP 104.

JSR 308(新位置的注释)包含在JEP 104下的java 8 中

As of 2017, JSR 305(new annotations) continues to carry official status of “Dormant”. A questionabout it's status in the google group has been unanswered since 2010.

截至 2017 年,JSR 305(新注释)继续保持官方状态为“休眠”。一个问题,自2010年以来它的谷歌的组中的地位一直无人接听。

There is a reference implementation of the JSR-305 annotations herewhich is used by many projects, including guava. With maven you can use the JSR-305 reference implementation by adding this to your pom:

还有就是JSR-305注释的参考实现这里所使用的许多项目,包括番石榴。使用 maven,您可以通过将其添加到您的 pom 来使用 JSR-305 参考实现:

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

回答by Kevin

According to Alex Millers Java 7 blog, JSR-308 (and 305) are scheduled to go in to Java 7. Perhaps he will show up here and give you more information.

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

回答by sbridges

JSR 305 will not be part of Java 8:

JSR 305 不会成为 Java 8 的一部分:

回答by Glen Best

Java 8 is described by JSR 337: the specification has reached Final status: see here.

Java 8 由 JSR 337 描述:规范已达到最终状态:请参阅此处

  • JSR 308 is definitely in
  • JSR 305 is definitely out
  • JSR 308 肯定在
  • JSR 305 绝对出局了