What is the status of JSR 305?

2019-01-21 08:17发布

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 308 and JSR 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.

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. 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.

标签: java jsr305
4条回答
够拽才男人
2楼-- · 2019-01-21 08:58

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

  • JSR 308 is definitely in
  • JSR 305 is definitely out
查看更多
再贱就再见
3楼-- · 2019-01-21 09:02

JSR 305 will not be part of Java 8:

查看更多
可以哭但决不认输i
4楼-- · 2019-01-21 09:17

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.

查看更多
爷、活的狠高调
5楼-- · 2019-01-21 09:23

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.

Quoting JSR 308 page:

…this document does not propose any annotations, merely specifying where they can appear in Java code.

JSR 308 (annotations in new places) is included in java 8 under JEP 104.

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

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

<dependency>
    <groupId>com.google.code.findbugs</groupId>
    <artifactId>jsr305</artifactId>
    <version>3.0.0</version>
</dependency>
查看更多
登录 后发表回答