From e6c1ee219fd851daf99d3836d1b48dcf5eacf0e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ezgi=20=C3=87i=C3=A7ek?= Date: Wed, 13 Nov 2019 09:14:04 -0800 Subject: [PATCH] [litho][required-props] Enable tracking all create and build methods intra-procedurally Summary: We were not tracking static `create ` and `build` methods intra-procedurally in the analysis and we just looked up their summaries. This resulted in not having static `create` methods in the trace. Let's fix that by pushing static check into `satisfy_heuristic`. This results in a few FPs, but such cases are not very common in the codebase. Reviewed By: skcho Differential Revision: D18451955 fbshipit-source-id: d4ccf46f5 --- infer/src/checkers/LithoFramework.ml | 3 +-- infer/src/checkers/RequiredProps.ml | 6 +++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/infer/src/checkers/LithoFramework.ml b/infer/src/checkers/LithoFramework.ml index 342007871..d27f8f212 100644 --- a/infer/src/checkers/LithoFramework.ml +++ b/infer/src/checkers/LithoFramework.ml @@ -115,7 +115,7 @@ struct match instr with | Call ( return_base - , Direct (Typ.Procname.Java java_callee_procname as callee_pname) + , Direct callee_pname , (HilExp.AccessExpression receiver_ae :: _ as actuals) , _ , location ) -> @@ -130,7 +130,6 @@ struct || (* track callee in order to report respective errors *) Domain.mem receiver astate (* track anything called on a receiver we're already tracking *) ) - && (not (Typ.Procname.Java.is_static java_callee_procname)) && LithoContext.satisfies_heuristic ~callee_pname ~callee_summary_opt tenv then let return_access_path = Domain.LocalAccessPath.make (return_base, []) caller_pname in diff --git a/infer/src/checkers/RequiredProps.ml b/infer/src/checkers/RequiredProps.ml index cc247ff1a..e04c191de 100644 --- a/infer/src/checkers/RequiredProps.ml +++ b/infer/src/checkers/RequiredProps.ml @@ -137,7 +137,11 @@ module LithoContext = struct || LithoFramework.is_component_create_method procname tenv ) call_set ) in - not build_exists_in_callees + match callee_pname with + | Typ.Procname.Java java_callee_procname -> + not (Typ.Procname.Java.is_static java_callee_procname || build_exists_in_callees) + | _ -> + not build_exists_in_callees let field = Payloads.Fields.litho_required_props