Annotation processor for javax.annotation.concurrent.ThreadSafe and GuardedBy
Clash Royale CLAN TAG#URR8PPP
Annotation processor for javax.annotation.concurrent.ThreadSafe and GuardedBy
How can I get the annotations javax.annotation.concurrent.ThreadSafe and GuardedBy to work?
I can't find the source code of an annotation processor for @ThreadSafe
and @GuardedBy
.
@ThreadSafe
@GuardedBy
but the GuardedBy is not for documentation purposes, GuardedBy how to work?
– daxin
Apr 11 at 2:18
It is for documentation purposes.
– shmosel
Apr 11 at 2:19
@Target( ElementType.FIELD, ElementType.METHOD ) @Retention(RetentionPolicy.CLASS) public @interface GuardedBy String value(); not has a @Documented!
– daxin
Apr 11 at 2:29
Probably because it generally documents internal implementation.
– shmosel
Apr 11 at 2:37
2 Answers
2
The Lock Checker that is distributed with the Checker Framework is an annotation processor that does compile-time checking of the @GuardedBy
annotation. If the Lock Checker issues no warnings, you get a guarantee that your program never dereferences a value unless it is holding the appropriate locks.
@GuardedBy
The IntelliJ IDE also has inspections that look for violations of the @GuardedBy annotations.
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
What are you talking about? Those annotations are for documentation purposes. They don't do anything.
– shmosel
Apr 11 at 1:57