I see that the above annotations are used extensively in the book JCIP . I think it is really useful because even in the absence of proper documentation it says some things about the synchronization policies . I also see that Intellij Idea makes use of these annotations Are they now actually part of the Java language itself ?
-
2No it is not part of the standard JDK - you need to import a dependency.– assyliasJul 6, 2012 at 12:38
-
On jcip.net, the jar link in "Concurrency annotations: jar, javadoc, source" at the bottom of the page.– assyliasJul 6, 2012 at 12:40
-
jcip.net/jcip-annotations.jar– Marko TopolnikJul 6, 2012 at 12:42
-
1thanks for this info. How can I accept a comment as an answer -:)? @assylias since you were the first to provide the link would you write something so that i can accept ?– InquisitiveJul 6, 2012 at 12:44
2 Answers
These are custom annotations that are not part of the standard JDK. To be able to use them in your code, you need to add a dependency.
At jcip.net, there is a link to the library and its source in the bottom part of the page "Concurrency annotations: jar, javadoc, source".
Direct links:
-
13These were standardized in JSR-305 (com.google.code.findbugs:jsr305:2.0.0) Jul 7, 2012 at 0:10
-
1The project's status is dormant. Do you know if there's any chance that it will be included at some stage?– assyliasJul 7, 2012 at 7:14
-
4They may be bundled in JSR-308 which is still active. The jsr305 annotations were intended for documentation only, so they offer value even if the jsr is dorment. Jul 7, 2012 at 8:30
-
4I'm disappointed that these annotations aren't standard. I won't include a library in my project just for documentation. So I'll just include the guarding details in my javadoc. Apr 17, 2014 at 12:37
You can add dependency from maven repository
"Java Concurrency In Practice" Book Annotations » 1.0