diff --git a/infer/documentation/issues/LOCKLESS_VIOLATION.md b/infer/documentation/issues/LOCKLESS_VIOLATION.md new file mode 100644 index 000000000..bffa82786 --- /dev/null +++ b/infer/documentation/issues/LOCKLESS_VIOLATION.md @@ -0,0 +1,18 @@ +A method implements an interface signature annotated with `@Lockless` but which transitively acquires a lock. + +Example: + +```java +Interface I { + @Lockless + public void no_lock(); +} + +class C implements I { + private synchronized do_lock() {} + + public void no_lock() { // this method should not acquire any locks + do_lock(); + } +} +``` diff --git a/infer/src/base/IssueType.ml b/infer/src/base/IssueType.ml index 7e920175d..b3257c7b1 100644 --- a/infer/src/base/IssueType.ml +++ b/infer/src/base/IssueType.ml @@ -661,7 +661,10 @@ let lock_consistency_violation = ~user_documentation:[%blob "../../documentation/issues/LOCK_CONSISTENCY_VIOLATION.md"] -let lockless_violation = register_from_string ~id:"LOCKLESS_VIOLATION" Error Starvation +let lockless_violation = + register_from_string ~id:"LOCKLESS_VIOLATION" Error Starvation + ~user_documentation:[%blob "../../documentation/issues/LOCKLESS_VIOLATION.md"] + let logging_private_data = register_from_string ~id:"LOGGING_PRIVATE_DATA" Error Quandary