From 24d28c6858a161db268c95bcd2db6c379ce71435 Mon Sep 17 00:00:00 2001 From: jrm Date: Thu, 10 Dec 2015 11:01:42 -0800 Subject: [PATCH] no longer fail when the type of an execption is not found in the type environement Summary: public Avoid the analysis to fail when the type of an exception cannot be found in the type environement Reviewed By: sblackshear Differential Revision: D2743015 fb-gh-sync-id: 7b922eb --- infer/src/harness/androidFramework.ml | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/infer/src/harness/androidFramework.ml b/infer/src/harness/androidFramework.ml index aaed199aa..1bff3183c 100644 --- a/infer/src/harness/androidFramework.ml +++ b/infer/src/harness/androidFramework.ml @@ -374,19 +374,15 @@ let get_lifecycles = android_lifecycles (** Checks if the exception is an uncheched exception *) let is_runtime_exception tenv exn = - let runtime_exception_opt = + let lookup = Sil.tenv_lookup tenv in + let runtime_exception_typename = let name = Mangled.from_package_class "java.lang" "RuntimeException" in - let typename = Sil.TN_csu (Sil.Class, name) in - Sil.tenv_lookup tenv typename in - match Sil.tenv_lookup tenv (Sil.TN_csu (Sil.Class, exn)) with - | None -> assert false - | Some exn_type -> - begin - match runtime_exception_opt with - | None -> false - | Some runtime_exception_type -> - is_subtype exn_type runtime_exception_type tenv - end + Sil.TN_csu (Sil.Class, name) + and exn_typename = Sil.TN_csu (Sil.Class, exn) in + match lookup runtime_exception_typename, lookup exn_typename with + | Some runtime_exception_type, Some exn_type -> + is_subtype exn_type runtime_exception_type tenv + | _ -> false let non_stub_android_jar () =