[infer][java] Infer should not suggest to add @Nullable for the field nullified on Fragement onDestroyView

Reviewed By: grievejia

Differential Revision: D5342213

fbshipit-source-id: 0213578
master
Jeremy Dubreil 8 years ago committed by Facebook Github Bot
parent f9e03681f8
commit 987347ceca

@ -178,6 +178,11 @@ let checker { Callbacks.summary; proc_desc; tenv; } =
in
Domain.iter report_access_path astate
in
let proc_name = Procdesc.get_proc_name proc_desc in
if AndroidFramework.is_destroy_method proc_name then
(* Skip the fields nullified in Fragment onDestroy and onDestroyView *)
summary
else
(* Assume all fields are not null in the beginning *)
let initial = Domain.empty, IdAccessPathMapDomain.empty in
let proc_data = ProcData.make_default proc_desc tenv in
@ -188,4 +193,4 @@ let checker { Callbacks.summary; proc_desc; tenv; } =
| None ->
failwithf
"Analyzer failed to compute post for %a"
Typ.Procname.pp (Procdesc.get_proc_name proc_data.pdesc)
Typ.Procname.pp proc_name

@ -26,10 +26,6 @@ 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()]

Loading…
Cancel
Save