[infer] report the Fragment Retains View issues as warnings instead of errors

Reviewed By: mbouaziz

Differential Revision: D14313596

fbshipit-source-id: 13a6824de
master
Jeremy Dubreil 6 years ago committed by Facebook Github Bot
parent f637f4229e
commit 130a729674

@ -32,7 +32,7 @@ let format_method pname =
Typ.Procname.to_string pname
let report_error fragment_typ fld fld_typ summary pdesc =
let report_warning fragment_typ fld fld_typ summary pdesc =
let pname = Procdesc.get_proc_name pdesc in
let description =
Printf.sprintf
@ -42,7 +42,7 @@ let report_error fragment_typ fld fld_typ summary pdesc =
(format_typ fragment_typ) (format_field fld) (format_typ fld_typ) (format_method pname)
in
let loc = Procdesc.get_loc pdesc in
Reporting.log_error summary ~loc IssueType.checkers_fragment_retain_view description
Reporting.log_warning summary ~loc IssueType.checkers_fragment_retain_view description
let callback_fragment_retains_view_java pname_java {Callbacks.proc_desc; summary; tenv} =
@ -76,7 +76,8 @@ let callback_fragment_retains_view_java pname_java {Callbacks.proc_desc; summary
not
( Annotations.ia_ends_with ia Annotations.auto_cleanup
|| Typ.Fieldname.Set.mem fname fields_nullified )
then report_error (Typ.mk (Tstruct class_typename)) fname fld_typ summary proc_desc )
then report_warning (Typ.mk (Tstruct class_typename)) fname fld_typ summary proc_desc
)
declared_view_fields
| _ ->
()

@ -26,9 +26,9 @@ codetoanalyze/java/checkers/ExpensiveInheritanceExample.java, codetoanalyze.java
codetoanalyze/java/checkers/ExpensiveInheritanceExample.java, codetoanalyze.java.checkers.ExpensiveInheritanceExample.reportsBecauseFooIsExpensiveInA(codetoanalyze.java.checkers.A):void, 1, CHECKERS_CALLS_EXPENSIVE_METHOD, no_bucket, ERROR, []
codetoanalyze/java/checkers/ExpensiveInterfaceExample.java, codetoanalyze.java.checkers.ExpensiveInterfaceExample$ImplementsInterface.m1():void, 1, CHECKERS_CALLS_EXPENSIVE_METHOD, no_bucket, ERROR, []
codetoanalyze/java/checkers/ExpensiveSubtypingExample.java, codetoanalyze.java.checkers.ExpensiveSubtypingExample.m3():void, 0, CHECKERS_EXPENSIVE_OVERRIDES_UNANNOTATED, no_bucket, ERROR, []
codetoanalyze/java/checkers/FragmentRetainsViewExample.java, codetoanalyze.java.checkers.FragmentRetainsViewExample.onDestroyView():void, 0, CHECKERS_FRAGMENT_RETAINS_VIEW, no_bucket, ERROR, []
codetoanalyze/java/checkers/FragmentRetainsViewExample.java, codetoanalyze.java.checkers.FragmentRetainsViewExample.onDestroyView():void, 0, CHECKERS_FRAGMENT_RETAINS_VIEW, no_bucket, ERROR, []
codetoanalyze/java/checkers/FragmentRetainsViewExample.java, codetoanalyze.java.checkers.FragmentRetainsViewExample.onDestroyView():void, 0, CHECKERS_FRAGMENT_RETAINS_VIEW, no_bucket, ERROR, []
codetoanalyze/java/checkers/FragmentRetainsViewExample.java, codetoanalyze.java.checkers.FragmentRetainsViewExample.onDestroyView():void, 0, CHECKERS_FRAGMENT_RETAINS_VIEW, no_bucket, WARNING, []
codetoanalyze/java/checkers/FragmentRetainsViewExample.java, codetoanalyze.java.checkers.FragmentRetainsViewExample.onDestroyView():void, 0, CHECKERS_FRAGMENT_RETAINS_VIEW, no_bucket, WARNING, []
codetoanalyze/java/checkers/FragmentRetainsViewExample.java, codetoanalyze.java.checkers.FragmentRetainsViewExample.onDestroyView():void, 0, CHECKERS_FRAGMENT_RETAINS_VIEW, no_bucket, WARNING, []
codetoanalyze/java/checkers/ImmutableCast.java, codetoanalyze.java.checkers.ImmutableCast.badCast(com.google.common.collect.ImmutableList):java.util.List, 0, CHECKERS_IMMUTABLE_CAST, no_bucket, WARNING, [Method badCast(...) returns class com.google.common.collect.ImmutableList but the return type is class java.util.List. Make sure that users of this method do not try to modify the collection.]
codetoanalyze/java/checkers/ImmutableCast.java, codetoanalyze.java.checkers.ImmutableCast.badCastFromField():java.util.List, 0, CHECKERS_IMMUTABLE_CAST, no_bucket, WARNING, [Method badCastFromField() returns class com.google.common.collect.ImmutableList but the return type is class java.util.List. Make sure that users of this method do not try to modify the collection.]
codetoanalyze/java/checkers/NoAllocationExample.java, codetoanalyze.java.checkers.NoAllocationExample.directlyAllocatingMethod():void, 1, CHECKERS_ALLOCATES_MEMORY, no_bucket, ERROR, []

Loading…
Cancel
Save