diff --git a/infer/src/checkers/NullabilitySuggest.ml b/infer/src/checkers/NullabilitySuggest.ml index ed1a60d68..67d99761a 100644 --- a/infer/src/checkers/NullabilitySuggest.ml +++ b/infer/src/checkers/NullabilitySuggest.ml @@ -164,10 +164,9 @@ let pretty_field_name proc_data field_name = (* This format is subject to change once this checker gets to run on C/Cpp/ObjC *) Fieldname.to_string field_name -let checker callback = +let checker ({ Callbacks.summary } as callback) = let report astate (proc_data : extras ProcData.t) = let report_access_path ap udchain = - let pname = Procdesc.get_proc_name proc_data.pdesc in let issue_kind = Localise.to_issue_id Localise.field_should_be_nullable in match AccessPath.Raw.get_field_and_annotation ap proc_data.tenv with | Some (field_name, _) -> @@ -180,9 +179,9 @@ let checker callback = begin match make_error_trace astate ap udchain with | Some (loc, ltr) -> - Reporting.log_warning_deprecated pname ~loc ~ltr exn + Reporting.log_warning summary ~loc ~ltr exn | None -> - Reporting.log_warning_deprecated pname exn + Reporting.log_warning summary exn end | _ -> () in diff --git a/infer/tests/codetoanalyze/java/checkers/FragmentDoesNotRetainViewExample.java b/infer/tests/codetoanalyze/java/checkers/FragmentDoesNotRetainViewExample.java index ec467c839..c1d014fdb 100644 --- a/infer/tests/codetoanalyze/java/checkers/FragmentDoesNotRetainViewExample.java +++ b/infer/tests/codetoanalyze/java/checkers/FragmentDoesNotRetainViewExample.java @@ -28,10 +28,10 @@ public class FragmentDoesNotRetainViewExample extends Fragment { } - @Nullable View mView1; - @Nullable View mView2; - @Nullable ViewGroup mViewSubclass; - @Nullable CustomView mCustomView; + View mView1; + View mView2; + ViewGroup mViewSubclass; + CustomView mCustomView; boolean b; diff --git a/infer/tests/codetoanalyze/java/checkers/issues.exp b/infer/tests/codetoanalyze/java/checkers/issues.exp index a61115c81..3d023fa3f 100644 --- a/infer/tests/codetoanalyze/java/checkers/issues.exp +++ b/infer/tests/codetoanalyze/java/checkers/issues.exp @@ -26,6 +26,10 @@ codetoanalyze/java/checkers/ExpensiveInheritanceExample.java, void ExpensiveInhe codetoanalyze/java/checkers/ExpensiveInheritanceExample.java, void ExpensiveInheritanceExample.reportsBecauseFooIsExpensiveInA(A), 1, CHECKERS_CALLS_EXPENSIVE_METHOD, [] codetoanalyze/java/checkers/ExpensiveInterfaceExample.java, void ExpensiveInterfaceExample$ImplementsInterface.m1(), 1, CHECKERS_CALLS_EXPENSIVE_METHOD, [] codetoanalyze/java/checkers/ExpensiveSubtypingExample.java, void ExpensiveSubtypingExample.m3(), 0, CHECKERS_EXPENSIVE_OVERRIDES_UNANNOTATED, [return from a call to void ExpensiveSubtypingExample.m3()] +codetoanalyze/java/checkers/FragmentDoesNotRetainViewExample.java, void FragmentDoesNotRetainViewExample.onDestroyView(), 1, FIELD_SHOULD_BE_NULLABLE, [Field mView1 is assigned null here] +codetoanalyze/java/checkers/FragmentDoesNotRetainViewExample.java, void FragmentDoesNotRetainViewExample.onDestroyView(), 3, FIELD_SHOULD_BE_NULLABLE, [Field mView2 is assigned null here] +codetoanalyze/java/checkers/FragmentDoesNotRetainViewExample.java, void FragmentDoesNotRetainViewExample.onDestroyView(), 5, FIELD_SHOULD_BE_NULLABLE, [Field mCustomView is assigned null here] +codetoanalyze/java/checkers/FragmentDoesNotRetainViewExample.java, void FragmentDoesNotRetainViewExample.onDestroyView(), 6, FIELD_SHOULD_BE_NULLABLE, [Field mViewSubclass is assigned null here] codetoanalyze/java/checkers/FragmentRetainsViewExample.java, void FragmentRetainsViewExample.onDestroyView(), 0, CHECKERS_FRAGMENT_RETAINS_VIEW, [return from a call to void FragmentRetainsViewExample.onDestroyView()] codetoanalyze/java/checkers/FragmentRetainsViewExample.java, void FragmentRetainsViewExample.onDestroyView(), 0, CHECKERS_FRAGMENT_RETAINS_VIEW, [return from a call to void FragmentRetainsViewExample.onDestroyView()] codetoanalyze/java/checkers/FragmentRetainsViewExample.java, void FragmentRetainsViewExample.onDestroyView(), 0, CHECKERS_FRAGMENT_RETAINS_VIEW, [return from a call to void FragmentRetainsViewExample.onDestroyView()]