From 301580a8192d8476b0bcf979015e77f2b38ceaec Mon Sep 17 00:00:00 2001 From: Nikos Gorogiannis Date: Sun, 14 Jun 2020 07:03:31 -0700 Subject: [PATCH] [starvation] document LOCKLESS_VIOLATION Summary: As per title. Reviewed By: jvillard Differential Revision: D22019459 fbshipit-source-id: 87e5bed9d --- .../documentation/issues/LOCKLESS_VIOLATION.md | 18 ++++++++++++++++++ infer/src/base/IssueType.ml | 5 ++++- 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 infer/documentation/issues/LOCKLESS_VIOLATION.md 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