[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
master
Ezgi Çiçek 5 years ago committed by Facebook Github Bot
parent 8d20e4d64d
commit e6c1ee219f

@ -115,7 +115,7 @@ struct
match instr with match instr with
| Call | Call
( return_base ( return_base
, Direct (Typ.Procname.Java java_callee_procname as callee_pname) , Direct callee_pname
, (HilExp.AccessExpression receiver_ae :: _ as actuals) , (HilExp.AccessExpression receiver_ae :: _ as actuals)
, _ , _
, location ) -> , location ) ->
@ -130,7 +130,6 @@ struct
|| (* track callee in order to report respective errors *) || (* track callee in order to report respective errors *)
Domain.mem receiver astate Domain.mem receiver astate
(* track anything called on a receiver we're already tracking *) ) (* 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 && LithoContext.satisfies_heuristic ~callee_pname ~callee_summary_opt tenv
then then
let return_access_path = Domain.LocalAccessPath.make (return_base, []) caller_pname in let return_access_path = Domain.LocalAccessPath.make (return_base, []) caller_pname in

@ -137,7 +137,11 @@ module LithoContext = struct
|| LithoFramework.is_component_create_method procname tenv ) || LithoFramework.is_component_create_method procname tenv )
call_set ) call_set )
in 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 let field = Payloads.Fields.litho_required_props

Loading…
Cancel
Save