46

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 ?

Inquisitive
  • 7,476
  • 14
  • 50
  • 61

2 Answers2

29

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:

Victor
  • 3,395
  • 1
  • 23
  • 26
assylias
  • 321,522
  • 82
  • 660
  • 783
  • 14
    These were standardized in JSR-305 (com.google.code.findbugs:jsr305:2.0.0) – Ben Manes Jul 07 '12 at 00:10
  • 1
    The project's status is dormant. Do you know if there's any chance that it will be included at some stage? – assylias Jul 07 '12 at 07:14
  • 4
    They 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. – Ben Manes Jul 07 '12 at 08:30
  • 4
    I'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. – Erick Robertson Apr 17 '14 at 12:37
0

You can add dependency from maven repository

"Java Concurrency In Practice" Book Annotations » 1.0

jcip-annotations-1.0

borino
  • 1,720
  • 1
  • 16
  • 24