Recently read up on JCIP annotations and they seem cool. Went to the website and took a look at the source. The only problem is that the src jar just contains the annotations...I'm not seeing where I can find the annotation processors that actually do anything! Am I just looking in the wrong place, or are these not real Java annotations (meaning, is there no way to enforce @Immutable
when it is used to mark a class)?
@Immutable
@GuardedBy
TL: DR — Yes, Java Concurrency in Practice is still valid and one of the best books to learn Java multithreading and concurrency concepts.
While Java isn't necessarily the best language for concurrency, there are a lot of tools, libraries, documentation and best practices out there to help. Using message passing and immutability instead of threads and shared state is considered the better approach to programming concurrent applications.
FindBugs supports those annotations. The support for those annotations and others is described in this documentation page.
The IntelliJ IDE will use these annotations to look for bugs in your code. If you annotate a variable is @GuardedBy(some_lock), the IDE will flag cases where you access it without properly synchronizing on it. This is very useful.
The JCIP annotations are a formal way to document a concurrency contract such as this member is "@GuardedBy" this field.
They don't do anything functionally in your code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With