From e5d52c3dc3491a51849808b1d16869b0437c83c1 Mon Sep 17 00:00:00 2001 From: Sungkeun Cho Date: Wed, 5 May 2021 09:56:01 -0700 Subject: [PATCH] [ConfigImapct] Add models of SharedPreferences methods Summary: This diff adds models of `SharedPreferences.get*` methods which are DB access. https://developer.android.com/reference/android/content/SharedPreferences Reviewed By: ezgicicek Differential Revision: D28220827 fbshipit-source-id: 5a78b09be --- infer/src/cost/ConfigImpactAnalysis.ml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/infer/src/cost/ConfigImpactAnalysis.ml b/infer/src/cost/ConfigImpactAnalysis.ml index babd43ea1..7f5582d5a 100644 --- a/infer/src/cost/ConfigImpactAnalysis.ml +++ b/infer/src/cost/ConfigImpactAnalysis.ml @@ -513,6 +513,11 @@ module Dom = struct let open ProcnameDispatcher.Call in make_dispatcher [ +BuiltinDecl.(match_builtin __cast) <>--> KnownCheap + ; +PatternMatch.Java.implements_android "content.SharedPreferences" + &:: "edit" &--> KnownExpensive + ; +PatternMatch.Java.implements_android "content.SharedPreferences" + &::+ (fun _ method_name -> String.is_prefix method_name ~prefix:"get") + &--> KnownExpensive ; +PatternMatch.Java.implements_google "common.base.Preconditions" &:: "checkArgument" $ any_arg $+ any_arg $+...$--> KnownExpensive ; +PatternMatch.Java.implements_google "common.base.Preconditions"