From ec7930be20373956a088d8d35a83dded55859b64 Mon Sep 17 00:00:00 2001 From: Nikos Gorogiannis Date: Mon, 15 Jun 2020 03:40:48 -0700 Subject: [PATCH] [annotreach] document issues Reviewed By: jvillard Differential Revision: D22034683 fbshipit-source-id: b354d14b3 --- .../issues/CHECKERS_ALLOCATES_MEMORY.md | 12 ++++++++++++ .../CHECKERS_ANNOTATION_REACHABILITY_ERROR.md | 1 + .../issues/CHECKERS_CALLS_EXPENSIVE_METHOD.md | 15 +++++++++++++++ .../CHECKERS_EXPENSIVE_OVERRIDES_UNANNOTATED.md | 14 ++++++++++++++ infer/src/base/IssueType.ml | 6 ++++++ 5 files changed, 48 insertions(+) create mode 100644 infer/documentation/issues/CHECKERS_ALLOCATES_MEMORY.md create mode 100644 infer/documentation/issues/CHECKERS_ANNOTATION_REACHABILITY_ERROR.md create mode 100644 infer/documentation/issues/CHECKERS_CALLS_EXPENSIVE_METHOD.md create mode 100644 infer/documentation/issues/CHECKERS_EXPENSIVE_OVERRIDES_UNANNOTATED.md diff --git a/infer/documentation/issues/CHECKERS_ALLOCATES_MEMORY.md b/infer/documentation/issues/CHECKERS_ALLOCATES_MEMORY.md new file mode 100644 index 000000000..482ad515a --- /dev/null +++ b/infer/documentation/issues/CHECKERS_ALLOCATES_MEMORY.md @@ -0,0 +1,12 @@ +A method annotated with `@NoAllocation` transitively calls `new`. + +Example: + +```java +class C implements I { + @NoAllocation + void directlyAllocatingMethod() { + new Object(); + } +} +``` diff --git a/infer/documentation/issues/CHECKERS_ANNOTATION_REACHABILITY_ERROR.md b/infer/documentation/issues/CHECKERS_ANNOTATION_REACHABILITY_ERROR.md new file mode 100644 index 000000000..c9e247596 --- /dev/null +++ b/infer/documentation/issues/CHECKERS_ANNOTATION_REACHABILITY_ERROR.md @@ -0,0 +1 @@ +A method annotated with an annotation `@A` transitively calls a method annotated `@B` where the combination of annotations is forbidden (for example, `@UiThread` calling `@WorkerThread`). diff --git a/infer/documentation/issues/CHECKERS_CALLS_EXPENSIVE_METHOD.md b/infer/documentation/issues/CHECKERS_CALLS_EXPENSIVE_METHOD.md new file mode 100644 index 000000000..602c36038 --- /dev/null +++ b/infer/documentation/issues/CHECKERS_CALLS_EXPENSIVE_METHOD.md @@ -0,0 +1,15 @@ +A method annotated with `@PerformanceCritical` transitively calls a method annotated `@Expensive`. + +Example: + +```java +class C { + @PerformanceCritical + void perfCritical() { + expensive(); + } + + @Expensive + void expensive() {} +} +``` diff --git a/infer/documentation/issues/CHECKERS_EXPENSIVE_OVERRIDES_UNANNOTATED.md b/infer/documentation/issues/CHECKERS_EXPENSIVE_OVERRIDES_UNANNOTATED.md new file mode 100644 index 000000000..d9e28c7de --- /dev/null +++ b/infer/documentation/issues/CHECKERS_EXPENSIVE_OVERRIDES_UNANNOTATED.md @@ -0,0 +1,14 @@ +A method annotated with `@Expensive` overrides an un-annotated method. + +Example: + +```java +interface I { + void foo(); +} + +class A implements I { + @Expensive + public void foo() {} +} +``` diff --git a/infer/src/base/IssueType.ml b/infer/src/base/IssueType.ml index 692e1f413..69916cc9d 100644 --- a/infer/src/base/IssueType.ml +++ b/infer/src/base/IssueType.ml @@ -307,21 +307,27 @@ let captured_strong_self = let checkers_allocates_memory = register_from_string ~id:"CHECKERS_ALLOCATES_MEMORY" ~hum:"Allocates Memory" Error AnnotationReachability + ~user_documentation:[%blob "../../documentation/issues/CHECKERS_ALLOCATES_MEMORY.md"] let checkers_annotation_reachability_error = register_from_string ~id:"CHECKERS_ANNOTATION_REACHABILITY_ERROR" ~hum:"Annotation Reachability Error" Error AnnotationReachability + ~user_documentation: + [%blob "../../documentation/issues/CHECKERS_ANNOTATION_REACHABILITY_ERROR.md"] let checkers_calls_expensive_method = register_from_string ~id:"CHECKERS_CALLS_EXPENSIVE_METHOD" ~hum:"Expensive Method Called" Error AnnotationReachability + ~user_documentation:[%blob "../../documentation/issues/CHECKERS_CALLS_EXPENSIVE_METHOD.md"] let checkers_expensive_overrides_unexpensive = register_from_string ~id:"CHECKERS_EXPENSIVE_OVERRIDES_UNANNOTATED" ~hum:"Expensive Overrides Unannotated" Error AnnotationReachability + ~user_documentation: + [%blob "../../documentation/issues/CHECKERS_EXPENSIVE_OVERRIDES_UNANNOTATED.md"] let checkers_fragment_retain_view =