[cleanup] organize Java-specific functions on types

Summary:
Was trying to decide where to add a new Java utility function and realized that things are a bit disorganized.
Some operations on `Typ.Name.t`'s live in `Typ.Procname`, and some live inside an inner `Java` module whereas some are outside of the module with a `java_` prefix.

Let's move toward putting all Java/C/Objc/C++-specific functions in dedicated modules.
This diff does some of the work for Java.
There are Java-specific functions that operate on `Typ.Procname.t`'s that will have to be converted to work on `Typ.Procname.Java.t`'s, but changing those clients will be more involved.
Will also move C/Objc/C++ functions in a follow-up.

Reviewed By: jeremydubreil

Differential Revision: D6737724

fbshipit-source-id: cdd6e68
master
Sam Blackshear 7 years ago committed by Facebook Github Bot
parent 1a5ba13778
commit 04d2882a6b

@ -61,7 +61,7 @@ let rec to_string = function
let s = let s =
match pname with match pname with
| Typ.Procname.Java pname_java -> | Typ.Procname.Java pname_java ->
Typ.Procname.java_get_method pname_java Typ.Procname.Java.get_method pname_java
| _ -> | _ ->
Typ.Procname.to_string pname Typ.Procname.to_string pname
in in

@ -252,14 +252,14 @@ let rec format_typ typ =
let format_field f = let format_field f =
if Config.curr_language_is Config.Java then Typ.Fieldname.java_get_field f if Config.curr_language_is Config.Java then Typ.Fieldname.Java.get_field f
else Typ.Fieldname.to_string f else Typ.Fieldname.to_string f
let format_method pname = let format_method pname =
match pname with match pname with
| Typ.Procname.Java pname_java -> | Typ.Procname.Java pname_java ->
Typ.Procname.java_get_method pname_java Typ.Procname.Java.get_method pname_java
| _ -> | _ ->
Typ.Procname.to_string pname Typ.Procname.to_string pname
@ -462,8 +462,8 @@ let desc_context_leak pname context_typ fieldname leak_path : error_desc =
| Typ.Procname.Java pname_java -> | Typ.Procname.Java pname_java ->
MF.monospaced_to_string MF.monospaced_to_string
(Printf.sprintf "%s.%s" (Printf.sprintf "%s.%s"
(Typ.Procname.java_get_class_name pname_java) (Typ.Procname.Java.get_class_name pname_java)
(Typ.Procname.java_get_method pname_java)) (Typ.Procname.Java.get_method pname_java))
| _ -> | _ ->
"" ""
in in

@ -396,6 +396,41 @@ module Name = struct
let java_io_serializable = from_string "java.io.Serializable" let java_io_serializable = from_string "java.io.Serializable"
let java_lang_cloneable = from_string "java.lang.Cloneable" let java_lang_cloneable = from_string "java.lang.Cloneable"
(** Given a package.class_name string, it looks for the latest dot and split the string
in two (package, class_name) *)
let split_classname package_classname =
match String.rsplit2 package_classname ~on:'.' with
| Some (x, y) ->
(Some x, y)
| None ->
(None, package_classname)
let split_typename typename = split_classname (name typename)
let get_parent_class class_name =
let package_name, class_name_no_package = split_typename class_name in
match String.rsplit2 ~on:'$' class_name_no_package with
| Some (parent_class, _) ->
Some (from_package_class (Option.value ~default:"" package_name) parent_class)
| None ->
None
let is_anonymous_inner_class_name class_name =
let class_name_no_package = snd (split_typename class_name) in
match String.rsplit2 class_name_no_package ~on:'$' with
| Some (_, s) ->
let is_int =
try
ignore (int_of_string (String.strip s)) ;
true
with Failure _ -> false
in
is_int
| None ->
false
end end
module Cpp = struct module Cpp = struct
@ -501,12 +536,6 @@ let rec java_from_string : string -> t = function
type typ = t type typ = t
module Procname = struct module Procname = struct
(* e.g. ("", "int") for primitive types or ("java.io", "PrintWriter") for objects *)
type java_type = string option * string
(* compare in inverse order *)
let compare_java_type (p1, c1) (p2, c2) = [%compare : string * string option] (c1, p1) (c2, p2)
type method_kind = type method_kind =
| Non_Static | Non_Static
(* in Java, procedures called with invokevirtual, invokespecial, and invokeinterface *) (* in Java, procedures called with invokevirtual, invokespecial, and invokeinterface *)
@ -516,8 +545,22 @@ module Procname = struct
let equal_method_kind = [%compare.equal : method_kind] let equal_method_kind = [%compare.equal : method_kind]
(** Level of verbosity of some to_string functions. *)
type detail_level = Verbose | Non_verbose | Simple [@@deriving compare]
let equal_detail_level = [%compare.equal : detail_level]
let is_verbose v = match v with Verbose -> true | _ -> false
module Java = struct
(* TODO: use Mangled.t here *)
type java_type = string option * string
(* compare in inverse order *)
let compare_java_type (p1, c1) (p2, c2) = [%compare : string * string option] (c1, p1) (c2, p2)
(** Type of java procedure names. *) (** Type of java procedure names. *)
type java = type t =
{ method_name: string { method_name: string
; parameters: java_type list ; parameters: java_type list
; class_name: Name.t ; class_name: Name.t
@ -525,6 +568,95 @@ module Procname = struct
; kind: method_kind } ; kind: method_kind }
[@@deriving compare] [@@deriving compare]
let make class_name return_type method_name parameters kind =
{class_name; return_type; method_name; parameters; kind}
(** A type is a pair (package, type_name) that is translated in a string package.type_name *)
let type_to_string_verbosity p verbosity =
match p with
| None, typ ->
typ
| Some p, cls ->
if is_verbose verbosity then p ^ "." ^ cls else cls
(** Given a list of types, it creates a unique string of types separated by commas *)
let rec param_list_to_string inputList verbosity =
match inputList with
| [] ->
""
| [head] ->
type_to_string_verbosity head verbosity
| head :: rest ->
type_to_string_verbosity head verbosity ^ "," ^ param_list_to_string rest verbosity
(** It is the same as java_type_to_string_verbosity, but Java return types are optional because
of constructors without type *)
let return_type_to_string j verbosity =
match j.return_type with None -> "" | Some typ -> type_to_string_verbosity typ verbosity
let get_class_name j = Name.name j.class_name
let get_class_type_name j = j.class_name
let get_simple_class_name j = snd (Name.Java.split_classname (get_class_name j))
let get_package j = fst (Name.Java.split_classname (get_class_name j))
let get_method j = j.method_name
let replace_method j mname = {j with method_name= mname}
let replace_return_type j ret_type = {j with return_type= Some ret_type}
let replace_parameters j parameters = {j with parameters}
let get_return_type j = return_type_to_string j Verbose
let get_parameters j = j.parameters
(** Prints a string of a java procname with the given level of verbosity *)
let to_string ?(withclass= false) j verbosity =
match verbosity with
| Verbose | Non_verbose ->
(* if verbose, then package.class.method(params): rtype,
else rtype package.class.method(params)
verbose is used for example to create unique filenames, non_verbose to create reports *)
let return_type = return_type_to_string j verbosity in
let params = param_list_to_string j.parameters verbosity in
let class_name =
type_to_string_verbosity (Name.Java.split_typename j.class_name) verbosity
in
let separator =
match (j.return_type, verbosity) with
| None, _ ->
""
| Some _, Verbose ->
":"
| _ ->
" "
in
let output = class_name ^ "." ^ j.method_name ^ "(" ^ params ^ ")" in
if equal_detail_level verbosity Verbose then output ^ separator ^ return_type
else return_type ^ separator ^ output
| Simple ->
(* methodname(...) or without ... if there are no parameters *)
let cls_prefix =
if withclass then
type_to_string_verbosity (Name.Java.split_typename j.class_name) verbosity ^ "."
else ""
in
let params = match j.parameters with [] -> "" | _ -> "..." in
let method_name =
if String.equal j.method_name "<init>" then get_simple_class_name j
else cls_prefix ^ j.method_name
in
method_name ^ "(" ^ params ^ ")"
end
(** Type of c procedure names. *) (** Type of c procedure names. *)
type c = type c =
{ name: QualifiedCppName.t { name: QualifiedCppName.t
@ -556,7 +688,7 @@ module Procname = struct
(** Type of procedure names. *) (** Type of procedure names. *)
type t = type t =
| Java of java | Java of Java.t
| C of c | C of c
| Linters_dummy_method | Linters_dummy_method
| Block of block_name | Block of block_name
@ -568,11 +700,6 @@ module Procname = struct
let hash = Hashtbl.hash let hash = Hashtbl.hash
(** Level of verbosity of some to_string functions. *)
type detail_level = Verbose | Non_verbose | Simple [@@deriving compare]
let equal_detail_level = [%compare.equal : detail_level]
let objc_method_kind_of_bool is_instance = let objc_method_kind_of_bool is_instance =
if is_instance then ObjCInstanceMethod else ObjCClassMethod if is_instance then ObjCInstanceMethod else ObjCClassMethod
@ -587,47 +714,6 @@ module Procname = struct
let empty_block = Block "" let empty_block = Block ""
let is_verbose v = match v with Verbose -> true | _ -> false
(** A type is a pair (package, type_name) that is translated in a string package.type_name *)
let java_type_to_string_verbosity p verbosity =
match p with
| None, typ ->
typ
| Some p, cls ->
if is_verbose verbosity then p ^ "." ^ cls else cls
(** Given a list of types, it creates a unique string of types separated by commas *)
let rec java_param_list_to_string inputList verbosity =
match inputList with
| [] ->
""
| [head] ->
java_type_to_string_verbosity head verbosity
| head :: rest ->
java_type_to_string_verbosity head verbosity ^ ","
^ java_param_list_to_string rest verbosity
(** It is the same as java_type_to_string_verbosity, but Java return types are optional because
of constructors without type *)
let java_return_type_to_string j verbosity =
match j.return_type with None -> "" | Some typ -> java_type_to_string_verbosity typ verbosity
(** Given a package.class_name string, it looks for the latest dot and split the string
in two (package, class_name) *)
let split_classname package_classname =
match String.rsplit2 package_classname ~on:'.' with
| Some (x, y) ->
(Some x, y)
| None ->
(None, package_classname)
let split_typename typename = split_classname (Name.name typename)
let c name mangled template_args ~is_generic_model = let c name mangled template_args ~is_generic_model =
{name; mangled= Some mangled; template_args; is_generic_model} {name; mangled= Some mangled; template_args; is_generic_model}
@ -640,10 +726,6 @@ module Procname = struct
; is_generic_model= false } ; is_generic_model= false }
let java class_name return_type method_name parameters kind =
{class_name; return_type; method_name; parameters; kind}
(** Create an objc procedure name from a class_name and method_name. *) (** Create an objc procedure name from a class_name and method_name. *)
let objc_cpp class_name method_name kind template_args ~is_generic_model = let objc_cpp class_name method_name kind template_args ~is_generic_model =
{class_name; method_name; kind; template_args; is_generic_model} {class_name; method_name; kind; template_args; is_generic_model}
@ -676,88 +758,13 @@ module Procname = struct
t t
let rec objc_cpp_replace_method_name t (new_method_name: string) = (** Check if the procedure name is an anonymous inner class constructor. *)
match t with let java_is_anonymous_inner_class_constructor = function
| ObjC_Cpp osig -> | Java js ->
ObjC_Cpp {osig with method_name= new_method_name} Name.Java.is_anonymous_inner_class_name js.class_name
| WithBlockParameters (base, blocks) -> | _ ->
WithBlockParameters (objc_cpp_replace_method_name base new_method_name, blocks) false
| C _ | Block _ | Linters_dummy_method | Java _ ->
t
(** Get the class name of a Objective-C/C++ procedure name. *)
let objc_cpp_get_class_name objc_cpp = Name.name objc_cpp.class_name
let objc_cpp_get_class_type_name objc_cpp = objc_cpp.class_name
(** Return the package.classname of a java procname. *)
let java_get_class_name (j: java) = Name.name j.class_name
(** Return the package.classname as a typename of a java procname. *)
let java_get_class_type_name (j: java) = j.class_name
(** Return the class name of a java procedure name. *)
let java_get_simple_class_name (j: java) = snd (split_classname (java_get_class_name j))
(** Return the package of a java procname. *)
let java_get_package (j: java) = fst (split_classname (java_get_class_name j))
(** Return the method of a java procname. *)
let java_get_method (j: java) = j.method_name
(** Replace the method of a java procname. *)
let java_replace_method (j: java) mname = {j with method_name= mname}
(** Replace the return type of a java procname. *)
let java_replace_return_type j ret_type = {j with return_type= Some ret_type}
(** Replace the parameters of a java procname. *)
let java_replace_parameters j parameters = {j with parameters}
(** Return the method/function of a procname. *)
let rec get_method = function
| ObjC_Cpp name ->
name.method_name
| WithBlockParameters (base, _) ->
get_method base
| C {name} ->
QualifiedCppName.to_qual_string name
| Block name ->
name
| Java j ->
j.method_name
| Linters_dummy_method ->
"Linters_dummy_method"
(** Return whether the procname is a block procname. *)
let is_objc_block = function Block _ -> true | _ -> false
(** Return whether the procname is a cpp lambda. *)
let is_cpp_lambda procname = String.is_substring ~substring:"operator()" (get_method procname)
(** Return the language of the procedure. *)
let get_language = function
| ObjC_Cpp _ ->
Config.Clang
| C _ ->
Config.Clang
| Block _ ->
Config.Clang
| Linters_dummy_method ->
Config.Clang
| WithBlockParameters _ ->
Config.Clang
| Java _ ->
Config.Java
(** Return the return type of a java procname. *)
let java_get_return_type (j: java) = java_return_type_to_string j Verbose
(** Return the parameters of a java procname. *)
let java_get_parameters j = j.parameters
(** Return true if the java procedure is static *) (** Return true if the java procedure is static *)
let java_is_static = function Java j -> equal_method_kind j.kind Static | _ -> false let java_is_static = function Java j -> equal_method_kind j.kind Static | _ -> false
@ -776,61 +783,6 @@ module Procname = struct
false false
(** Prints a string of a java procname with the given level of verbosity *)
let java_to_string ?(withclass= false) (j: java) verbosity =
match verbosity with
| Verbose | Non_verbose ->
(* if verbose, then package.class.method(params): rtype,
else rtype package.class.method(params)
verbose is used for example to create unique filenames, non_verbose to create reports *)
let return_type = java_return_type_to_string j verbosity in
let params = java_param_list_to_string j.parameters verbosity in
let class_name = java_type_to_string_verbosity (split_typename j.class_name) verbosity in
let separator =
match (j.return_type, verbosity) with None, _ -> "" | Some _, Verbose -> ":" | _ -> " "
in
let output = class_name ^ "." ^ j.method_name ^ "(" ^ params ^ ")" in
if equal_detail_level verbosity Verbose then output ^ separator ^ return_type
else return_type ^ separator ^ output
| Simple ->
(* methodname(...) or without ... if there are no parameters *)
let cls_prefix =
if withclass then
java_type_to_string_verbosity (split_typename j.class_name) verbosity ^ "."
else ""
in
let params = match j.parameters with [] -> "" | _ -> "..." in
let method_name =
if String.equal j.method_name "<init>" then java_get_simple_class_name j
else cls_prefix ^ j.method_name
in
method_name ^ "(" ^ params ^ ")"
(** Check if the class name is for an anonymous inner class. *)
let is_anonymous_inner_class_name class_name =
let class_name_no_package = snd (split_typename class_name) in
match String.rsplit2 class_name_no_package ~on:'$' with
| Some (_, s) ->
let is_int =
try
ignore (int_of_string (String.strip s)) ;
true
with Failure _ -> false
in
is_int
| None ->
false
(** Check if the procedure name is an anonymous inner class constructor. *)
let java_is_anonymous_inner_class_constructor = function
| Java js ->
is_anonymous_inner_class_name js.class_name
| _ ->
false
(** Check if the procedure name is an acess method (e.g. access$100 used to (** Check if the procedure name is an acess method (e.g. access$100 used to
access private members from a nested class. *) access private members from a nested class. *)
let java_is_access_method = function let java_is_access_method = function
@ -867,6 +819,59 @@ module Procname = struct
false false
let rec objc_cpp_replace_method_name t (new_method_name: string) =
match t with
| ObjC_Cpp osig ->
ObjC_Cpp {osig with method_name= new_method_name}
| WithBlockParameters (base, blocks) ->
WithBlockParameters (objc_cpp_replace_method_name base new_method_name, blocks)
| C _ | Block _ | Linters_dummy_method | Java _ ->
t
(** Get the class name of a Objective-C/C++ procedure name. *)
let objc_cpp_get_class_name objc_cpp = Name.name objc_cpp.class_name
let objc_cpp_get_class_type_name objc_cpp = objc_cpp.class_name
(** Return the method/function of a procname. *)
let rec get_method = function
| ObjC_Cpp name ->
name.method_name
| WithBlockParameters (base, _) ->
get_method base
| C {name} ->
QualifiedCppName.to_qual_string name
| Block name ->
name
| Java j ->
j.method_name
| Linters_dummy_method ->
"Linters_dummy_method"
(** Return whether the procname is a block procname. *)
let is_objc_block = function Block _ -> true | _ -> false
(** Return whether the procname is a cpp lambda. *)
let is_cpp_lambda procname = String.is_substring ~substring:"operator()" (get_method procname)
(** Return the language of the procedure. *)
let get_language = function
| ObjC_Cpp _ ->
Config.Clang
| C _ ->
Config.Clang
| Block _ ->
Config.Clang
| Linters_dummy_method ->
Config.Clang
| WithBlockParameters _ ->
Config.Clang
| Java _ ->
Config.Java
let is_objc_constructor method_name = let is_objc_constructor method_name =
String.equal method_name "new" || String.is_prefix ~prefix:"init" method_name String.equal method_name "new" || String.is_prefix ~prefix:"init" method_name
@ -919,7 +924,7 @@ module Procname = struct
match pn with match pn with
| Java j -> | Java j ->
let regexp = Str.regexp "com.facebook.infer.builtins.InferUndefined" in let regexp = Str.regexp "com.facebook.infer.builtins.InferUndefined" in
Str.string_match regexp (java_get_class_name j) 0 Str.string_match regexp (Java.get_class_name j) 0
| _ -> | _ ->
(* TODO: add cases for obj-c, c, c++ *) (* TODO: add cases for obj-c, c, c++ *)
false false
@ -977,7 +982,7 @@ module Procname = struct
let rec to_unique_id pn = let rec to_unique_id pn =
match pn with match pn with
| Java j -> | Java j ->
java_to_string j Verbose Java.to_string j Verbose
| C {name; mangled} -> | C {name; mangled} ->
to_readable_string (name, mangled) true to_readable_string (name, mangled) true
| ObjC_Cpp osig -> | ObjC_Cpp osig ->
@ -994,7 +999,7 @@ module Procname = struct
let rec to_string p = let rec to_string p =
match p with match p with
| Java j -> | Java j ->
java_to_string j Non_verbose Java.to_string j Non_verbose
| C {name; mangled} -> | C {name; mangled} ->
to_readable_string (name, mangled) false to_readable_string (name, mangled) false
| ObjC_Cpp osig -> | ObjC_Cpp osig ->
@ -1011,7 +1016,7 @@ module Procname = struct
let rec to_simplified_string ?(withclass= false) p = let rec to_simplified_string ?(withclass= false) p =
match p with match p with
| Java j -> | Java j ->
java_to_string ~withclass j Simple Java.to_string ~withclass j Simple
| C {name; mangled} -> | C {name; mangled} ->
to_readable_string (name, mangled) false ^ "()" to_readable_string (name, mangled) false ^ "()"
| ObjC_Cpp osig -> | ObjC_Cpp osig ->
@ -1030,7 +1035,7 @@ module Procname = struct
(* Strip autogenerated anonymous inner class numbers in order to keep the bug hash (* Strip autogenerated anonymous inner class numbers in order to keep the bug hash
invariant when introducing new annonynous classes *) invariant when introducing new annonynous classes *)
Str.global_replace (Str.regexp "$[0-9]+") "$_" Str.global_replace (Str.regexp "$[0-9]+") "$_"
(java_to_string ~withclass:true pname Simple) (Java.to_string ~withclass:true pname Simple)
| ObjC_Cpp _ when is_objc_method p -> | ObjC_Cpp _ when is_objc_method p ->
(* In Objective C, the list of parameters is part of the method name. To prevent the bug (* In Objective C, the list of parameters is part of the method name. To prevent the bug
hash to change when a parameter is introduced or removed, only the part of the name hash to change when a parameter is introduced or removed, only the part of the name
@ -1143,7 +1148,7 @@ end
(** Return the return type of [pname_java]. *) (** Return the return type of [pname_java]. *)
let java_proc_return_typ pname_java : t = let java_proc_return_typ pname_java : t =
let typ = java_from_string (Procname.java_get_return_type pname_java) in let typ = java_from_string (Procname.Java.get_return_type pname_java) in
match typ.desc with Tstruct _ -> mk (Tptr (typ, Pk_pointer)) | _ -> typ match typ.desc with Tstruct _ -> mk (Tptr (typ, Pk_pointer)) | _ -> typ
@ -1202,32 +1207,6 @@ module Fieldname = struct
fname fname
(** Returns the class part of the fieldname *)
let java_get_class fn =
let fn = to_string fn in
let ri = String.rindex_exn fn '.' in
String.slice fn 0 ri
(** Returns the last component of the fieldname *)
let java_get_field fn =
let fn = to_string fn in
let ri = 1 + String.rindex_exn fn '.' in
String.slice fn ri 0
(** Check if the field is the synthetic this$n of a nested class, used to access the n-th outher instance. *)
let java_is_outer_instance fn =
let fn = to_string fn in
let fn_len = String.length fn in
fn_len <> 0
&&
let this = ".this$" in
let last_char = fn.[fn_len - 1] in
(last_char >= '0' && last_char <= '9')
&& String.is_suffix fn ~suffix:(this ^ String.of_char last_char)
let clang_get_qual_class = function let clang_get_qual_class = function
| Clang {class_name} -> | Clang {class_name} ->
Some (Name.qual_name class_name) Some (Name.qual_name class_name)
@ -1248,6 +1227,29 @@ module Fieldname = struct
String.is_prefix ~prefix:"val$" (to_flat_string field_name) String.is_prefix ~prefix:"val$" (to_flat_string field_name)
| Clang _ -> | Clang _ ->
false false
let get_class fn =
let fn = to_string fn in
let ri = String.rindex_exn fn '.' in
String.slice fn 0 ri
let get_field fn =
let fn = to_string fn in
let ri = 1 + String.rindex_exn fn '.' in
String.slice fn ri 0
let is_outer_instance fn =
let fn = to_string fn in
let fn_len = String.length fn in
fn_len <> 0
&&
let this = ".this$" in
let last_char = fn.[fn_len - 1] in
(last_char >= '0' && last_char <= '9')
&& String.is_suffix fn ~suffix:(this ^ String.of_char last_char)
end end
end end

@ -159,6 +159,14 @@ module Name : sig
val is_class : t -> bool val is_class : t -> bool
(** [is_class name] holds if [name] names a Java class *) (** [is_class name] holds if [name] names a Java class *)
val split_classname : string -> string option * string
(** Given a package.class_name string, look for the latest dot and split the string
in two (package, class_name). *)
val get_parent_class : t -> t option
(** Given an inner classname like C$Inner1$Inner2, return Some C$Inner1. If the class is not an
inner class, return None *)
val java_lang_object : t val java_lang_object : t
val java_io_serializable : t val java_io_serializable : t
@ -250,8 +258,49 @@ type typ = t
module Procname : sig module Procname : sig
(** Module for Procedure Names. *) (** Module for Procedure Names. *)
type method_kind =
| Non_Static
(** in Java, procedures called with invokevirtual, invokespecial, and invokeinterface *)
| Static (** in Java, procedures called with invokestatic *)
(** Type of java procedure names. *) (** Type of java procedure names. *)
type java module Java : sig
type t [@@deriving compare]
(** e.g. ("", "int") for primitive types or ("java.io", "PrintWriter") for objects *)
type java_type = string option * string
val make : Name.t -> java_type option -> string -> java_type list -> method_kind -> t
(** Create a Java procedure name from its
class_name method_name args_type_name return_type_name method_kind. *)
val replace_parameters : t -> java_type list -> t
(** Replace the parameters of a java procname. *)
val replace_return_type : t -> java_type -> t
(** Replace the method of a java procname. *)
val get_class_name : t -> string
(** Return the class name of a java procedure name. *)
val get_class_type_name : t -> Name.t
(** Return the class name as a typename of a java procedure name. *)
val get_simple_class_name : t -> string
(** Return the simple class name of a java procedure name. *)
val get_package : t -> string option
(** Return the package name of a java procedure name. *)
val get_method : t -> string
(** Return the method name of a java procedure name. *)
val get_parameters : t -> java_type list
(** Return the parameters of a java procedure name. *)
val replace_method : t -> string -> t
(** Replace the method name of an existing java procname. *)
end
(** Type of c procedure names. *) (** Type of c procedure names. *)
type c = private type c = private
@ -286,7 +335,7 @@ module Procname : sig
bar() {foo(my_block)} is executed as foo_my_block() {my_block(); } bar() {foo(my_block)} is executed as foo_my_block() {my_block(); }
where foo_my_block is created with WithBlockParameters (foo, [my_block]) *) where foo_my_block is created with WithBlockParameters (foo, [my_block]) *)
type t = type t =
| Java of java | Java of Java.t
| C of c | C of c
| Linters_dummy_method | Linters_dummy_method
| Block of block_name | Block of block_name
@ -298,13 +347,6 @@ module Procname : sig
val equal : t -> t -> bool val equal : t -> t -> bool
type java_type = string option * string
type method_kind =
| Non_Static
(** in Java, procedures called with invokevirtual, invokespecial, and invokeinterface *)
| Static (** in Java, procedures called with invokestatic *)
(** Hash tables with proc names as keys. *) (** Hash tables with proc names as keys. *)
module Hashable : Caml.Hashtbl.HashedType with type t = t module Hashable : Caml.Hashtbl.HashedType with type t = t
@ -371,16 +413,6 @@ module Procname : sig
val is_destructor : t -> bool val is_destructor : t -> bool
(** Check if this is a dealloc method. *) (** Check if this is a dealloc method. *)
val java : Name.t -> java_type option -> string -> java_type list -> method_kind -> java
(** Create a Java procedure name from its
class_name method_name args_type_name return_type_name method_kind. *)
val java_replace_parameters : java -> java_type list -> java
(** Replace the parameters of a java procname. *)
val java_replace_return_type : java -> java_type -> java
(** Replace the method of a java procname. *)
val mangled_objc_block : string -> t val mangled_objc_block : string -> t
(** Create an objc block name. *) (** Create an objc block name. *)
@ -403,24 +435,6 @@ module Procname : sig
val objc_method_kind_of_bool : bool -> objc_cpp_method_kind val objc_method_kind_of_bool : bool -> objc_cpp_method_kind
(** Create ObjC method type from a bool is_instance. *) (** Create ObjC method type from a bool is_instance. *)
val java_get_class_name : java -> string
(** Return the class name of a java procedure name. *)
val java_get_class_type_name : java -> Name.t
(** Return the class name as a typename of a java procedure name. *)
val java_get_simple_class_name : java -> string
(** Return the simple class name of a java procedure name. *)
val java_get_package : java -> string option
(** Return the package name of a java procedure name. *)
val java_get_method : java -> string
(** Return the method name of a java procedure name. *)
val java_get_parameters : java -> java_type list
(** Return the parameters of a java procedure name. *)
val java_is_access_method : t -> bool val java_is_access_method : t -> bool
(** Check if the procedure name is an acess method (e.g. access$100 used to (** Check if the procedure name is an acess method (e.g. access$100 used to
access private members from a nested class. *) access private members from a nested class. *)
@ -447,9 +461,6 @@ module Procname : sig
val java_is_generated : t -> bool val java_is_generated : t -> bool
(** Check if the proc name comes from generated code *) (** Check if the proc name comes from generated code *)
val java_replace_method : java -> string -> java
(** Replace the method name of an existing java procname. *)
val is_class_initializer : t -> bool val is_class_initializer : t -> bool
(** Check if this is a class initializer. *) (** Check if this is a class initializer. *)
@ -467,10 +478,6 @@ module Procname : sig
(** Replace the class name component of a procedure name. (** Replace the class name component of a procedure name.
In case of Java, replace package and class name. *) In case of Java, replace package and class name. *)
val split_classname : string -> string option * string
(** Given a package.class_name string, look for the latest dot and split the string
in two (package, class_name). *)
val to_string : t -> string val to_string : t -> string
(** Convert a proc name to a string for the user to see. *) (** Convert a proc name to a string for the user to see. *)
@ -493,7 +500,7 @@ module Procname : sig
(** get qualifiers of a class owning objc/C++ method *) (** get qualifiers of a class owning objc/C++ method *)
end end
val java_proc_return_typ : Procname.java -> t val java_proc_return_typ : Procname.Java.t -> t
(** Return the return type of [pname_java]. *) (** Return the return type of [pname_java]. *)
module Fieldname : sig module Fieldname : sig
@ -521,6 +528,16 @@ module Fieldname : sig
val is_captured_parameter : t -> bool val is_captured_parameter : t -> bool
(** Check if field is a captured parameter *) (** Check if field is a captured parameter *)
val get_class : t -> string
(** The class part of the fieldname *)
val get_field : t -> string
(** The last component of the fieldname *)
val is_outer_instance : t -> bool
(** Check if the field is the synthetic this$n of a nested class, used to access the n-th outer
instance. *)
end end
val to_string : t -> string val to_string : t -> string
@ -539,15 +556,6 @@ module Fieldname : sig
val pp : Format.formatter -> t -> unit val pp : Format.formatter -> t -> unit
(** Pretty print a field name. *) (** Pretty print a field name. *)
val java_get_class : t -> string
(** The class part of the fieldname *)
val java_get_field : t -> string
(** The last component of the fieldname *)
val java_is_outer_instance : t -> bool
(** Check if the field is the synthetic this$n of a nested class, used to access the n-th outher instance. *)
val clang_get_qual_class : t -> QualifiedCppName.t option val clang_get_qual_class : t -> QualifiedCppName.t option
(** get qualified classname of a field if it's coming from clang frontend. returns None otherwise *) (** get qualified classname of a field if it's coming from clang frontend. returns None otherwise *)
end end

@ -182,7 +182,7 @@ let get_vararg_type_names tenv (call_node: Procdesc.Node.t) (ivar: Pvar.t) : str
let is_getter pname_java = let is_getter pname_java =
Str.string_match (Str.regexp "get*") (Typ.Procname.java_get_method pname_java) 0 Str.string_match (Str.regexp "get*") (Typ.Procname.Java.get_method pname_java) 0
let type_is_class typ = let type_is_class typ =
@ -228,7 +228,7 @@ let method_is_initializer (tenv: Tenv.t) (proc_attributes: ProcAttributes.t) : b
if type_has_initializer tenv this_type then if type_has_initializer tenv this_type then
match proc_attributes.ProcAttributes.proc_name with match proc_attributes.ProcAttributes.proc_name with
| Typ.Procname.Java pname_java -> | Typ.Procname.Java pname_java ->
let mname = Typ.Procname.java_get_method pname_java in let mname = Typ.Procname.Java.get_method pname_java in
List.exists ~f:(String.equal mname) initializer_methods List.exists ~f:(String.equal mname) initializer_methods
| _ -> | _ ->
false false
@ -299,7 +299,7 @@ let override_exists f tenv proc_name =
match proc_name with match proc_name with
| Typ.Procname.Java proc_name_java -> | Typ.Procname.Java proc_name_java ->
let type_name = let type_name =
Typ.Name.Java.from_string (Typ.Procname.java_get_class_name proc_name_java) Typ.Name.Java.from_string (Typ.Procname.Java.get_class_name proc_name_java)
in in
List.exists ~f:(super_type_exists tenv) List.exists ~f:(super_type_exists tenv)
(type_get_direct_supertypes tenv (Typ.mk (Tstruct type_name))) (type_get_direct_supertypes tenv (Typ.mk (Tstruct type_name)))
@ -345,7 +345,7 @@ let is_throwable tenv typename = is_subtype_of_str tenv typename "java.lang.Thro
let check_class_attributes check tenv = function let check_class_attributes check tenv = function
| Typ.Procname.Java java_pname -> | Typ.Procname.Java java_pname ->
let check_class_annots _ {Typ.Struct.annots} = check annots in let check_class_annots _ {Typ.Struct.annots} = check annots in
supertype_exists tenv check_class_annots (Typ.Procname.java_get_class_type_name java_pname) supertype_exists tenv check_class_annots (Typ.Procname.Java.get_class_type_name java_pname)
| _ -> | _ ->
false false
@ -354,7 +354,7 @@ let check_class_attributes check tenv = function
for the current class only*) for the current class only*)
let check_current_class_attributes check tenv = function let check_current_class_attributes check tenv = function
| Typ.Procname.Java java_pname -> ( | Typ.Procname.Java java_pname -> (
match Tenv.lookup tenv (Typ.Procname.java_get_class_type_name java_pname) with match Tenv.lookup tenv (Typ.Procname.Java.get_class_type_name java_pname) with
| Some struct_typ -> | Some struct_typ ->
check struct_typ.annots check struct_typ.annots
| _ -> | _ ->

@ -23,7 +23,7 @@ val get_vararg_type_names : Tenv.t -> Procdesc.Node.t -> Pvar.t -> string list
val method_is_initializer : Tenv.t -> ProcAttributes.t -> bool val method_is_initializer : Tenv.t -> ProcAttributes.t -> bool
(** Check if the method is one of the known initializer methods. *) (** Check if the method is one of the known initializer methods. *)
val is_getter : Typ.Procname.java -> bool val is_getter : Typ.Procname.Java.t -> bool
(** Is this a getter proc name? *) (** Is this a getter proc name? *)
val is_subtype : Tenv.t -> Typ.Name.t -> Typ.Name.t -> bool val is_subtype : Tenv.t -> Typ.Name.t -> Typ.Name.t -> bool

@ -109,8 +109,8 @@ module FileOrProcMatcher = struct
~init:String.Map.empty m_patterns ~init:String.Map.empty m_patterns
in in
let do_java pname_java = let do_java pname_java =
let class_name = Typ.Procname.java_get_class_name pname_java let class_name = Typ.Procname.Java.get_class_name pname_java
and method_name = Typ.Procname.java_get_method pname_java in and method_name = Typ.Procname.Java.get_method pname_java in
try try
let class_patterns = String.Map.find_exn pattern_map class_name in let class_patterns = String.Map.find_exn pattern_map class_name in
List.exists List.exists

@ -1084,7 +1084,7 @@ let report_runtime_exceptions tenv pdesc summary =
match pname with match pname with
| Typ.Procname.Java pname_java -> | Typ.Procname.Java pname_java ->
Typ.Procname.java_is_static pname Typ.Procname.java_is_static pname
&& String.equal (Typ.Procname.java_get_method pname_java) "main" && String.equal (Typ.Procname.Java.get_method pname_java) "main"
| _ -> | _ ->
false false
in in

@ -753,7 +753,7 @@ let add_guarded_by_constraints tenv prop lexp pdesc =
let guarded_by_str_is_current_class guarded_by_str = function let guarded_by_str_is_current_class guarded_by_str = function
| Typ.Procname.Java java_pname -> | Typ.Procname.Java java_pname ->
(* programmers write @GuardedBy("MyClass.class") when the field is guarded by the class *) (* programmers write @GuardedBy("MyClass.class") when the field is guarded by the class *)
guarded_by_str_is_class guarded_by_str (Typ.Procname.java_get_class_name java_pname) guarded_by_str_is_class guarded_by_str (Typ.Procname.Java.get_class_name java_pname)
| _ -> | _ ->
false false
in in
@ -765,7 +765,7 @@ let add_guarded_by_constraints tenv prop lexp pdesc =
let guarded_by_str_is_super_class_this guarded_by_str pname = let guarded_by_str_is_super_class_this guarded_by_str pname =
match pname with match pname with
| Typ.Procname.Java java_pname -> | Typ.Procname.Java java_pname ->
let current_class_type_name = Typ.Procname.java_get_class_type_name java_pname in let current_class_type_name = Typ.Procname.Java.get_class_type_name java_pname in
let comparison class_type_name _ = let comparison class_type_name _ =
guarded_by_str_is_class_this (Typ.Name.to_string class_type_name) guarded_by_str guarded_by_str_is_class_this (Typ.Name.to_string class_type_name) guarded_by_str
in in
@ -776,7 +776,7 @@ let add_guarded_by_constraints tenv prop lexp pdesc =
(* return true if [guarded_by_str] is as suffix of "<name_of_current_class>.this" *) (* return true if [guarded_by_str] is as suffix of "<name_of_current_class>.this" *)
let guarded_by_str_is_current_class_this guarded_by_str = function let guarded_by_str_is_current_class_this guarded_by_str = function
| Typ.Procname.Java java_pname -> | Typ.Procname.Java java_pname ->
guarded_by_str_is_class_this (Typ.Procname.java_get_class_name java_pname) guarded_by_str guarded_by_str_is_class_this (Typ.Procname.Java.get_class_name java_pname) guarded_by_str
| _ -> | _ ->
false false
in in
@ -807,7 +807,7 @@ let add_guarded_by_constraints tenv prop lexp pdesc =
match extract_guarded_by_str item_annot with match extract_guarded_by_str item_annot with
| Some "this" -> | Some "this" ->
(* expand "this" into <classname>.this *) (* expand "this" into <classname>.this *)
Some (Printf.sprintf "%s.this" (Typ.Fieldname.java_get_class fld)) Some (Printf.sprintf "%s.this" (Typ.Fieldname.Java.get_class fld))
| guarded_by_str_opt -> | guarded_by_str_opt ->
guarded_by_str_opt ) guarded_by_str_opt )
| _ -> | _ ->
@ -876,7 +876,7 @@ let add_guarded_by_constraints tenv prop lexp pdesc =
(* if the guarded-by string is "OuterClass.this", look for "this$n" for some n. (* if the guarded-by string is "OuterClass.this", look for "this$n" for some n.
note that this is a bit sketchy when there are mutliple this$n's, but there's note that this is a bit sketchy when there are mutliple this$n's, but there's
nothing we can do to disambiguate them. *) nothing we can do to disambiguate them. *)
get_fld_strexp_and_typ typ (fun f _ -> Typ.Fieldname.java_is_outer_instance f) flds get_fld_strexp_and_typ typ (fun f _ -> Typ.Fieldname.Java.is_outer_instance f) flds
| None -> | None ->
(* can't find an exact match. try a different convention. *) (* can't find an exact match. try a different convention. *)
match_on_field_type typ flds match_on_field_type typ flds

@ -586,7 +586,7 @@ let resolve_virtual_pname tenv prop actuals callee_pname call_flags : Typ.Procna
match pname with match pname with
| Typ.Procname.Java pname_java | Typ.Procname.Java pname_java
-> ( -> (
let name = Typ.Procname.java_get_class_type_name pname_java in let name = Typ.Procname.Java.get_class_type_name pname_java in
match Tenv.lookup tenv name with match Tenv.lookup tenv name with
| Some _ -> | Some _ ->
Typ.mk (Typ.Tptr (Typ.mk (Tstruct name), Pk_pointer)) Typ.mk (Typ.Tptr (Typ.mk (Tstruct name), Pk_pointer))
@ -633,25 +633,25 @@ let resolve_virtual_pname tenv prop actuals callee_pname call_flags : Typ.Procna
(** Resolve the name of the procedure to call based on the type of the arguments *) (** Resolve the name of the procedure to call based on the type of the arguments *)
let resolve_java_pname tenv prop args pname_java call_flags : Typ.Procname.java = let resolve_java_pname tenv prop args pname_java call_flags : Typ.Procname.Java.t =
let resolve_from_args resolved_pname_java args = let resolve_from_args resolved_pname_java args =
let resolved_params = let resolved_params =
List.fold2_exn List.fold2_exn
~f:(fun accu (arg_exp, _) name -> ~f:(fun accu (arg_exp, _) name ->
match resolve_typename prop arg_exp with match resolve_typename prop arg_exp with
| Some class_name -> | Some class_name ->
Typ.Procname.split_classname (Typ.Name.name class_name) :: accu Typ.Name.Java.split_classname (Typ.Name.name class_name) :: accu
| None -> | None ->
name :: accu ) name :: accu )
~init:[] args ~init:[] args
(Typ.Procname.java_get_parameters resolved_pname_java) (Typ.Procname.Java.get_parameters resolved_pname_java)
|> List.rev |> List.rev
in in
Typ.Procname.java_replace_parameters resolved_pname_java resolved_params Typ.Procname.Java.replace_parameters resolved_pname_java resolved_params
in in
let resolved_pname_java, other_args = let resolved_pname_java, other_args =
let pname = Typ.Procname.Java pname_java let pname = Typ.Procname.Java pname_java
and parameters = Typ.Procname.java_get_parameters pname_java in and parameters = Typ.Procname.Java.get_parameters pname_java in
let match_parameters args = Int.equal (List.length args) (List.length parameters) in let match_parameters args = Int.equal (List.length args) (List.length parameters) in
match args with match args with
| [] -> | [] ->
@ -721,7 +721,7 @@ let resolve_and_analyze tenv caller_pdesc prop args callee_proc_name call_flags
let call_constructor_url_update_args pname actual_params = let call_constructor_url_update_args pname actual_params =
let url_pname = let url_pname =
Typ.Procname.Java Typ.Procname.Java
(Typ.Procname.java (Typ.Procname.Java.make
(Typ.Name.Java.from_string "java.net.URL") (Typ.Name.Java.from_string "java.net.URL")
None "<init>" [(Some "java.lang", "String")] Typ.Procname.Non_Static) None "<init>" [(Some "java.lang", "String")] Typ.Procname.Non_Static)
in in

@ -1323,7 +1323,7 @@ let exe_call_postprocess tenv ret_id trace_call callee_pname callee_attrs loc re
let should_add_ret_attr _ = let should_add_ret_attr _ =
let is_likely_getter = function let is_likely_getter = function
| Typ.Procname.Java pn_java -> | Typ.Procname.Java pn_java ->
Int.equal (List.length (Typ.Procname.java_get_parameters pn_java)) 0 Int.equal (List.length (Typ.Procname.Java.get_parameters pn_java)) 0
| _ -> | _ ->
false false
in in

@ -112,7 +112,7 @@ module TransferFunctions (CFG : ProcCfg.S) = struct
match pname with match pname with
| Typ.Procname.Java java_proc -> | Typ.Procname.Java java_proc ->
String.equal frame.Stacktrace.class_str String.equal frame.Stacktrace.class_str
(Typ.Procname.java_get_class_name java_proc) (Typ.Procname.Java.get_class_name java_proc)
| Typ.Procname.ObjC_Cpp objc_cpp_prod -> | Typ.Procname.ObjC_Cpp objc_cpp_prod ->
String.equal frame.Stacktrace.class_str String.equal frame.Stacktrace.class_str
(Typ.Procname.objc_cpp_get_class_name objc_cpp_prod) (Typ.Procname.objc_cpp_get_class_name objc_cpp_prod)

@ -37,7 +37,7 @@ module TransferFunctions (CFG : ProcCfg.S) = struct
-> ( -> (
PatternMatch.is_getter java_procname PatternMatch.is_getter java_procname
&& &&
match Typ.Procname.java_get_package java_procname with match Typ.Procname.Java.get_package java_procname with
| Some package -> | Some package ->
String.is_prefix ~prefix:"com.facebook.graphql.model" package String.is_prefix ~prefix:"com.facebook.graphql.model" package
| None -> | None ->
@ -150,7 +150,7 @@ let unroll_call call astate summary =
let should_report proc_desc = let should_report proc_desc =
match Procdesc.get_proc_name proc_desc with match Procdesc.get_proc_name proc_desc with
| Typ.Procname.Java java_pname -> ( | Typ.Procname.Java java_pname -> (
match Typ.Procname.java_get_method java_pname with "onCreateLayout" -> true | _ -> false ) match Typ.Procname.Java.get_method java_pname with "onCreateLayout" -> true | _ -> false )
| _ -> | _ ->
false false

@ -140,8 +140,8 @@ let make_error_trace astate ap ud =
let pretty_field_name proc_data field_name = let pretty_field_name proc_data field_name =
match Procdesc.get_proc_name proc_data.ProcData.pdesc with match Procdesc.get_proc_name proc_data.ProcData.pdesc with
| Typ.Procname.Java jproc_name -> | Typ.Procname.Java jproc_name ->
let proc_class_name = Typ.Procname.java_get_class_name jproc_name in let proc_class_name = Typ.Procname.Java.get_class_name jproc_name in
let field_class_name = Typ.Fieldname.java_get_class field_name in let field_class_name = Typ.Fieldname.Java.get_class field_name in
if String.equal proc_class_name field_class_name then Typ.Fieldname.to_flat_string field_name if String.equal proc_class_name field_class_name then Typ.Fieldname.to_flat_string field_name
else Typ.Fieldname.to_simplified_string field_name else Typ.Fieldname.to_simplified_string field_name
| _ -> | _ ->
@ -154,7 +154,7 @@ let pretty_field_name proc_data field_name =
let is_outside_codebase proc_desc tenv field_name = let is_outside_codebase proc_desc tenv field_name =
match Procdesc.get_proc_name proc_desc with match Procdesc.get_proc_name proc_desc with
| Typ.Procname.Java _ -> | Typ.Procname.Java _ ->
let class_name = Typ.Fieldname.java_get_class field_name in let class_name = Typ.Fieldname.Java.get_class field_name in
let class_type = Typ.Name.Java.from_string class_name in let class_type = Typ.Name.Java.from_string class_name in
let class_struct = Tenv.lookup tenv class_type in let class_struct = Tenv.lookup tenv class_type in
let first_method = let first_method =

@ -23,7 +23,7 @@ let drawable_prefix = "R$drawable"
let is_destroy_method pname = let is_destroy_method pname =
match pname with match pname with
| Typ.Procname.Java pname_java -> | Typ.Procname.Java pname_java ->
let method_name = Typ.Procname.java_get_method pname_java in let method_name = Typ.Procname.Java.get_method pname_java in
String.equal method_name on_destroy || String.equal method_name on_destroy_view String.equal method_name on_destroy || String.equal method_name on_destroy_view
| _ -> | _ ->
false false

@ -77,7 +77,7 @@ let is_modeled_expensive tenv = function
&& &&
let is_subclass = let is_subclass =
let classname = let classname =
Typ.Name.Java.from_string (Typ.Procname.java_get_class_name proc_name_java) Typ.Name.Java.from_string (Typ.Procname.Java.get_class_name proc_name_java)
in in
PatternMatch.is_subtype_of_str tenv classname PatternMatch.is_subtype_of_str tenv classname
in in
@ -90,7 +90,7 @@ let is_allocator tenv pname =
match pname with match pname with
| Typ.Procname.Java pname_java -> | Typ.Procname.Java pname_java ->
let is_throwable () = let is_throwable () =
let class_name = Typ.Name.Java.from_string (Typ.Procname.java_get_class_name pname_java) in let class_name = Typ.Name.Java.from_string (Typ.Procname.Java.get_class_name pname_java) in
PatternMatch.is_throwable tenv class_name PatternMatch.is_throwable tenv class_name
in in
Typ.Procname.is_constructor pname && not (BuiltinDecl.is_declared pname) Typ.Procname.is_constructor pname && not (BuiltinDecl.is_declared pname)
@ -372,7 +372,7 @@ module TransferFunctions (CFG : ProcCfg.S) = struct
let is_unlikely pname = let is_unlikely pname =
match pname with match pname with
| Typ.Procname.Java java_pname -> | Typ.Procname.Java java_pname ->
String.equal (Typ.Procname.java_get_method java_pname) "unlikely" String.equal (Typ.Procname.Java.get_method java_pname) "unlikely"
| _ -> | _ ->
false false

@ -25,7 +25,7 @@ let callback_fragment_retains_view_java pname_java {Callbacks.proc_desc; summary
(* TODO: complain if onDestroyView is not defined, yet the Fragment has View fields *) (* TODO: complain if onDestroyView is not defined, yet the Fragment has View fields *)
(* TODO: handle fields nullified in callees in the same file *) (* TODO: handle fields nullified in callees in the same file *)
let is_on_destroy_view = let is_on_destroy_view =
String.equal (Typ.Procname.java_get_method pname_java) "onDestroyView" String.equal (Typ.Procname.Java.get_method pname_java) "onDestroyView"
in in
let fld_typ_is_view typ = let fld_typ_is_view typ =
match typ.Typ.desc with match typ.Typ.desc with
@ -36,11 +36,11 @@ let callback_fragment_retains_view_java pname_java {Callbacks.proc_desc; summary
in in
(* is [fldname] a View type declared by [class_typename]? *) (* is [fldname] a View type declared by [class_typename]? *)
let is_declared_view_typ class_typename (fldname, fld_typ, _) = let is_declared_view_typ class_typename (fldname, fld_typ, _) =
let fld_classname = Typ.Name.Java.from_string (Typ.Fieldname.java_get_class fldname) in let fld_classname = Typ.Name.Java.from_string (Typ.Fieldname.Java.get_class fldname) in
Typ.Name.equal fld_classname class_typename && fld_typ_is_view fld_typ Typ.Name.equal fld_classname class_typename && fld_typ_is_view fld_typ
in in
if is_on_destroy_view then if is_on_destroy_view then
let class_typename = Typ.Name.Java.from_string (Typ.Procname.java_get_class_name pname_java) in let class_typename = Typ.Name.Java.from_string (Typ.Procname.Java.get_class_name pname_java) in
match Tenv.lookup tenv class_typename with match Tenv.lookup tenv class_typename with
| Some {fields} when AndroidFramework.is_fragment tenv class_typename -> | Some {fields} when AndroidFramework.is_fragment tenv class_typename ->
let declared_view_fields = List.filter ~f:(is_declared_view_typ class_typename) fields in let declared_view_fields = List.filter ~f:(is_declared_view_typ class_typename) fields in

@ -126,7 +126,7 @@ module TransferFunctions (CFG : ProcCfg.S) = struct
(** return true if this function is library code from the JDK core libraries or Android *) (** return true if this function is library code from the JDK core libraries or Android *)
let is_java_library = function let is_java_library = function
| Typ.Procname.Java java_pname -> ( | Typ.Procname.Java java_pname -> (
match Typ.Procname.java_get_package java_pname with match Typ.Procname.Java.get_package java_pname with
| Some package_name -> | Some package_name ->
String.is_prefix ~prefix:"java." package_name String.is_prefix ~prefix:"java." package_name
|| String.is_prefix ~prefix:"android." package_name || String.is_prefix ~prefix:"android." package_name
@ -139,7 +139,7 @@ module TransferFunctions (CFG : ProcCfg.S) = struct
let is_builder_function = function let is_builder_function = function
| Typ.Procname.Java java_pname -> | Typ.Procname.Java java_pname ->
String.is_suffix ~suffix:"$Builder" (Typ.Procname.java_get_class_name java_pname) String.is_suffix ~suffix:"$Builder" (Typ.Procname.Java.get_class_name java_pname)
| _ -> | _ ->
false false
@ -231,7 +231,7 @@ module TransferFunctions (CFG : ProcCfg.S) = struct
let is_modeled_functional = function let is_modeled_functional = function
| Typ.Procname.Java java_pname -> ( | Typ.Procname.Java java_pname -> (
match match
(Typ.Procname.java_get_class_name java_pname, Typ.Procname.java_get_method java_pname) (Typ.Procname.Java.get_class_name java_pname, Typ.Procname.Java.get_method java_pname)
with with
| "android.content.res.Resources", method_name -> | "android.content.res.Resources", method_name ->
(* all methods of Resources are considered @Functional except for the ones in this (* all methods of Resources are considered @Functional except for the ones in this
@ -261,7 +261,7 @@ module TransferFunctions (CFG : ProcCfg.S) = struct
let is_owned_in_library = function let is_owned_in_library = function
| Typ.Procname.Java java_pname -> ( | Typ.Procname.Java java_pname -> (
match match
(Typ.Procname.java_get_class_name java_pname, Typ.Procname.java_get_method java_pname) (Typ.Procname.Java.get_class_name java_pname, Typ.Procname.Java.get_method java_pname)
with with
| "javax.inject.Provider", "get" -> | "javax.inject.Provider", "get" ->
(* in dependency injection, the library allocates fresh values behind the scenes *) (* in dependency injection, the library allocates fresh values behind the scenes *)
@ -296,7 +296,7 @@ module TransferFunctions (CFG : ProcCfg.S) = struct
let is_threadsafe_collection pn tenv = let is_threadsafe_collection pn tenv =
match pn with match pn with
| Typ.Procname.Java java_pname -> | Typ.Procname.Java java_pname ->
let typename = Typ.Name.Java.from_string (Typ.Procname.java_get_class_name java_pname) in let typename = Typ.Name.Java.from_string (Typ.Procname.Java.get_class_name java_pname) in
let aux tn _ = let aux tn _ =
match Typ.Name.name tn with match Typ.Name.name tn with
| "java.util.concurrent.ConcurrentMap" | "java.util.concurrent.ConcurrentMap"
@ -326,7 +326,7 @@ module TransferFunctions (CFG : ProcCfg.S) = struct
| (AccessPath.FieldAccess base_field) :: (AccessPath.FieldAccess container_field) :: _ | (AccessPath.FieldAccess base_field) :: (AccessPath.FieldAccess container_field) :: _
when Typ.Procname.is_java callee_pname -> when Typ.Procname.is_java callee_pname ->
let base_typename = let base_typename =
Typ.Name.Java.from_string (Typ.Fieldname.java_get_class base_field) Typ.Name.Java.from_string (Typ.Fieldname.Java.get_class base_field)
in in
is_annotated_synchronized base_typename container_field tenv is_annotated_synchronized base_typename container_field tenv
| [(AccessPath.FieldAccess container_field)] -> ( | [(AccessPath.FieldAccess container_field)] -> (
@ -393,7 +393,7 @@ module TransferFunctions (CFG : ProcCfg.S) = struct
let is_box = function let is_box = function
| Typ.Procname.Java java_pname -> ( | Typ.Procname.Java java_pname -> (
match match
(Typ.Procname.java_get_class_name java_pname, Typ.Procname.java_get_method java_pname) (Typ.Procname.Java.get_class_name java_pname, Typ.Procname.Java.get_method java_pname)
with with
| ( ( "java.lang.Boolean" | ( ( "java.lang.Boolean"
| "java.lang.Byte" | "java.lang.Byte"
@ -861,7 +861,7 @@ let should_analyze_proc pdesc tenv =
let get_current_class_and_threadsafe_superclasses tenv pname = let get_current_class_and_threadsafe_superclasses tenv pname =
match pname with match pname with
| Typ.Procname.Java java_pname -> | Typ.Procname.Java java_pname ->
let current_class = Typ.Procname.java_get_class_type_name java_pname in let current_class = Typ.Procname.Java.get_class_type_name java_pname in
let thread_safe_annotated_classes = let thread_safe_annotated_classes =
PatternMatch.find_superclasses_with_attributes is_thread_safe tenv current_class PatternMatch.find_superclasses_with_attributes is_thread_safe tenv current_class
in in
@ -1215,7 +1215,7 @@ let report_thread_safety_violation tenv pdesc ~make_description ~report_kind acc
let report_unannotated_interface_violation tenv pdesc access thread reported_pname = let report_unannotated_interface_violation tenv pdesc access thread reported_pname =
match reported_pname with match reported_pname with
| Typ.Procname.Java java_pname -> | Typ.Procname.Java java_pname ->
let class_name = Typ.Procname.java_get_class_name java_pname in let class_name = Typ.Procname.Java.get_class_name java_pname in
let make_description _ _ _ _ = let make_description _ _ _ _ =
F.asprintf F.asprintf
"Unprotected call to method of un-annotated interface %s. Consider annotating the class with %a, adding a lock, or using an interface that is known to be thread-safe." "Unprotected call to method of un-annotated interface %s. Consider annotating the class with %a, adding a lock, or using an interface that is known to be thread-safe."
@ -1231,8 +1231,8 @@ let report_unannotated_interface_violation tenv pdesc access thread reported_pna
let pp_procname_short fmt = function let pp_procname_short fmt = function
| Typ.Procname.Java java -> | Typ.Procname.Java java ->
F.fprintf fmt "%s.%s" F.fprintf fmt "%s.%s"
(Typ.Procname.java_get_class_name java) (Typ.Procname.Java.get_class_name java)
(Typ.Procname.java_get_method java) (Typ.Procname.Java.get_method java)
| pname -> | pname ->
Typ.Procname.pp fmt pname Typ.Procname.pp fmt pname
@ -1654,7 +1654,7 @@ let aggregate_by_class file_env =
let classname = let classname =
match pname with match pname with
| Typ.Procname.Java java_pname -> | Typ.Procname.Java java_pname ->
Typ.Procname.java_get_class_name java_pname Typ.Procname.Java.get_class_name java_pname
| _ -> | _ ->
"unknown" "unknown"
in in

@ -28,21 +28,21 @@ module Models = struct
type container_access = ContainerRead | ContainerWrite type container_access = ContainerRead | ContainerWrite
let is_thread_utils_type java_pname = let is_thread_utils_type java_pname =
let pn = Typ.Procname.java_get_class_name java_pname in let pn = Typ.Procname.Java.get_class_name java_pname in
String.is_suffix ~suffix:"ThreadUtils" pn || String.is_suffix ~suffix:"ThreadUtil" pn String.is_suffix ~suffix:"ThreadUtils" pn || String.is_suffix ~suffix:"ThreadUtil" pn
let is_thread_utils_method method_name_str = function let is_thread_utils_method method_name_str = function
| Typ.Procname.Java java_pname -> | Typ.Procname.Java java_pname ->
is_thread_utils_type java_pname is_thread_utils_type java_pname
&& String.equal (Typ.Procname.java_get_method java_pname) method_name_str && String.equal (Typ.Procname.Java.get_method java_pname) method_name_str
| _ -> | _ ->
false false
let get_thread = function let get_thread = function
| Typ.Procname.Java java_pname when is_thread_utils_type java_pname -> ( | Typ.Procname.Java java_pname when is_thread_utils_type java_pname -> (
match Typ.Procname.java_get_method java_pname with match Typ.Procname.Java.get_method java_pname with
| "assertMainThread" | "assertOnUiThread" | "checkOnMainThread" -> | "assertMainThread" | "assertOnUiThread" | "checkOnMainThread" ->
MainThread MainThread
| "isMainThread" | "isUiThread" -> | "isMainThread" | "isUiThread" ->
@ -110,7 +110,7 @@ module Models = struct
if is_thread_utils_method "assertHoldsLock" (Typ.Procname.Java java_pname) then Lock if is_thread_utils_method "assertHoldsLock" (Typ.Procname.Java java_pname) then Lock
else else
match match
(Typ.Procname.java_get_class_name java_pname, Typ.Procname.java_get_method java_pname) (Typ.Procname.Java.get_class_name java_pname, Typ.Procname.Java.get_method java_pname)
with with
| ( ( "java.util.concurrent.locks.Lock" | ( ( "java.util.concurrent.locks.Lock"
| "java.util.concurrent.locks.ReentrantLock" | "java.util.concurrent.locks.ReentrantLock"
@ -173,9 +173,9 @@ module Models = struct
fun pn tenv -> fun pn tenv ->
match pn with match pn with
| Typ.Procname.Java java_pname -> | Typ.Procname.Java java_pname ->
let typename = Typ.Name.Java.from_string (Typ.Procname.java_get_class_name java_pname) in let typename = Typ.Name.Java.from_string (Typ.Procname.Java.get_class_name java_pname) in
let get_container_access_ typename = let get_container_access_ typename =
match (Typ.Name.name typename, Typ.Procname.java_get_method java_pname) with match (Typ.Name.name typename, Typ.Procname.Java.get_method java_pname) with
| ( ("android.util.SparseArray" | "android.support.v4.util.SparseArrayCompat") | ( ("android.util.SparseArray" | "android.support.v4.util.SparseArrayCompat")
, ( "append" , ( "append"
| "clear" | "clear"

@ -180,7 +180,7 @@ module MkCallback (Extension : ExtensionT) : CallBackT = struct
let get_class_opt pn = let get_class_opt pn =
match pn with match pn with
| Typ.Procname.Java pn_java -> | Typ.Procname.Java pn_java ->
Some (Typ.Procname.java_get_class_name pn_java) Some (Typ.Procname.Java.get_class_name pn_java)
| _ -> | _ ->
None None
in in
@ -259,7 +259,7 @@ module MkCallback (Extension : ExtensionT) : CallBackT = struct
let get_class pn = let get_class pn =
match pn with match pn with
| Typ.Procname.Java pn_java -> | Typ.Procname.Java pn_java ->
Some (Typ.Procname.java_get_class_name pn_java) Some (Typ.Procname.Java.get_class_name pn_java)
| _ -> | _ ->
None None

@ -189,13 +189,13 @@ let check_field_assignment tenv find_canonical_duplicate curr_pdesc node instr_r
in in
not (TypeAnnotation.get_value AnnotatedSignature.Nullable ta_lhs) not (TypeAnnotation.get_value AnnotatedSignature.Nullable ta_lhs)
&& TypeAnnotation.get_value AnnotatedSignature.Nullable ta_rhs && TypeAnnotation.get_value AnnotatedSignature.Nullable ta_rhs
&& PatternMatch.type_is_class t_lhs && not (Typ.Fieldname.java_is_outer_instance fname) && PatternMatch.type_is_class t_lhs && not (Typ.Fieldname.Java.is_outer_instance fname)
&& not (field_is_field_injector_readwrite ()) && not (field_is_field_injector_readwrite ())
in in
let should_report_absent = let should_report_absent =
Config.eradicate_optional_present && TypeAnnotation.get_value AnnotatedSignature.Present ta_lhs Config.eradicate_optional_present && TypeAnnotation.get_value AnnotatedSignature.Present ta_lhs
&& not (TypeAnnotation.get_value AnnotatedSignature.Present ta_rhs) && not (TypeAnnotation.get_value AnnotatedSignature.Present ta_rhs)
&& not (Typ.Fieldname.java_is_outer_instance fname) && not (Typ.Fieldname.Java.is_outer_instance fname)
in in
let should_report_mutable = let should_report_mutable =
let field_is_mutable () = let field_is_mutable () =
@ -267,11 +267,11 @@ let check_constructor_initialization tenv find_canonical_duplicate curr_pname cu
in in
let should_check_field_initialization = let should_check_field_initialization =
let in_current_class = let in_current_class =
let fld_cname = Typ.Fieldname.java_get_class fn in let fld_cname = Typ.Fieldname.Java.get_class fn in
String.equal (Typ.Name.name name) fld_cname String.equal (Typ.Name.name name) fld_cname
in in
not injector_readonly_annotated && PatternMatch.type_is_class ft && in_current_class not injector_readonly_annotated && PatternMatch.type_is_class ft && in_current_class
&& not (Typ.Fieldname.java_is_outer_instance fn) && not (Typ.Fieldname.Java.is_outer_instance fn)
in in
if should_check_field_initialization then ( if should_check_field_initialization then (
if Models.Inference.enabled then Models.Inference.field_add_nullable_annotation fn ; if Models.Inference.enabled then Models.Inference.field_add_nullable_annotation fn ;

@ -349,7 +349,7 @@ let typecheck_instr tenv ext calls_this checks (node: Procdesc.Node.t) idenv get
let pvar = Pvar.mk (Mangled.from_string fld_name) curr_pname in let pvar = Pvar.mk (Mangled.from_string fld_name) curr_pname in
let typestate' = update_typestate_fld pvar inner_origin fn typ in let typestate' = update_typestate_fld pvar inner_origin fn typ in
(Exp.Lvar pvar, typestate') (Exp.Lvar pvar, typestate')
| Exp.Lfield (_exp', fn', _) when Typ.Fieldname.java_is_outer_instance fn' -> | Exp.Lfield (_exp', fn', _) when Typ.Fieldname.Java.is_outer_instance fn' ->
(* handle double dereference when accessing a field from an outer class *) (* handle double dereference when accessing a field from an outer class *)
let fld_name = Typ.Fieldname.to_string fn' ^ "_" ^ Typ.Fieldname.to_string fn in let fld_name = Typ.Fieldname.to_string fn' ^ "_" ^ Typ.Fieldname.to_string fn in
let pvar = Pvar.mk (Mangled.from_string fld_name) curr_pname in let pvar = Pvar.mk (Mangled.from_string fld_name) curr_pname in
@ -377,8 +377,8 @@ let typecheck_instr tenv ext calls_this checks (node: Procdesc.Node.t) idenv get
match (curr_pname, pn) with match (curr_pname, pn) with
| Typ.Procname.Java curr_pname_java, Typ.Procname.Java pn_java -> | Typ.Procname.Java curr_pname_java, Typ.Procname.Java pn_java ->
if String.equal if String.equal
(Typ.Procname.java_get_class_name curr_pname_java) (Typ.Procname.Java.get_class_name curr_pname_java)
(Typ.Procname.java_get_class_name pn_java) (Typ.Procname.Java.get_class_name pn_java)
then calls_this := true then calls_this := true
| _ -> | _ ->
() ()
@ -708,9 +708,9 @@ let typecheck_instr tenv ext calls_this checks (node: Procdesc.Node.t) idenv get
let pname_get_from_pname_put pname_put = let pname_get_from_pname_put pname_put =
let object_t = (Some "java.lang", "Object") in let object_t = (Some "java.lang", "Object") in
let parameters = [object_t] in let parameters = [object_t] in
Typ.Procname.java_replace_parameters Typ.Procname.Java.replace_parameters
(Typ.Procname.java_replace_return_type (Typ.Procname.Java.replace_return_type
(Typ.Procname.java_replace_method pname_put "get") (Typ.Procname.Java.replace_method pname_put "get")
object_t) object_t)
parameters parameters
in in
@ -849,7 +849,7 @@ let typecheck_instr tenv ext calls_this checks (node: Procdesc.Node.t) idenv get
let has_method pn name = let has_method pn name =
match pn with match pn with
| Typ.Procname.Java pn_java -> | Typ.Procname.Java pn_java ->
String.equal (Typ.Procname.java_get_method pn_java) name String.equal (Typ.Procname.Java.get_method pn_java) name
| _ -> | _ ->
false false
in in
@ -916,8 +916,8 @@ let typecheck_instr tenv ext calls_this checks (node: Procdesc.Node.t) idenv get
(DExp.Dconst Const.Cfun Typ.Procname.Java pname_java, args, loc, call_flags) -> (DExp.Dconst Const.Cfun Typ.Procname.Java pname_java, args, loc, call_flags) ->
let pname_java' = let pname_java' =
let object_t = (Some "java.lang", "Object") in let object_t = (Some "java.lang", "Object") in
Typ.Procname.java_replace_return_type Typ.Procname.Java.replace_return_type
(Typ.Procname.java_replace_method pname_java "get") (Typ.Procname.Java.replace_method pname_java "get")
object_t object_t
in in
let fun_dexp = DExp.Dconst (Const.Cfun (Typ.Procname.Java pname_java')) in let fun_dexp = DExp.Dconst (Const.Cfun (Typ.Procname.Java pname_java')) in

@ -297,7 +297,7 @@ let report_error_now tenv (st_report_error: st_report_error) err_instance loc pd
else else
match pn with match pn with
| Typ.Procname.Java pn_java -> | Typ.Procname.Java pn_java ->
MF.monospaced_to_string (Typ.Procname.java_get_method pn_java) MF.monospaced_to_string (Typ.Procname.Java.get_method pn_java)
| _ -> | _ ->
MF.monospaced_to_string (Typ.Procname.to_simplified_string pn) MF.monospaced_to_string (Typ.Procname.to_simplified_string pn)
in in
@ -340,7 +340,7 @@ let report_error_now tenv (st_report_error: st_report_error) err_instance loc pd
else else
match pn with match pn with
| Typ.Procname.Java pn_java -> | Typ.Procname.Java pn_java ->
Typ.Procname.java_get_method pn_java Typ.Procname.Java.get_method pn_java
| _ -> | _ ->
Typ.Procname.to_simplified_string pn Typ.Procname.to_simplified_string pn
in in

@ -27,8 +27,8 @@ let fix_method_definition_line linereader proc_name loc =
let inner_class_name cname = let inner_class_name cname =
match String.rsplit2 cname ~on:'$' with Some (_, icn) -> icn | None -> cname match String.rsplit2 cname ~on:'$' with Some (_, icn) -> icn | None -> cname
in in
inner_class_name (Typ.Procname.java_get_simple_class_name proc_name_java) inner_class_name (Typ.Procname.Java.get_simple_class_name proc_name_java)
else Typ.Procname.java_get_method proc_name_java else Typ.Procname.Java.get_method proc_name_java
in in
let regex = Str.regexp (Str.quote method_name) in let regex = Str.regexp (Str.quote method_name) in
let method_is_defined_here linenum = let method_is_defined_here linenum =

@ -224,7 +224,7 @@ let get_method_procname cn ms method_kind =
let return_type_name, method_name, args_type_name = method_signature_names ms in let return_type_name, method_name, args_type_name = method_signature_names ms in
let class_name = Typ.Name.Java.from_string (JBasics.cn_name cn) in let class_name = Typ.Name.Java.from_string (JBasics.cn_name cn) in
let proc_name_java = let proc_name_java =
Typ.Procname.java class_name return_type_name method_name args_type_name method_kind Typ.Procname.Java.make class_name return_type_name method_name args_type_name method_kind
in in
Typ.Procname.Java proc_name_java Typ.Procname.Java proc_name_java
@ -406,7 +406,7 @@ let get_class_type program tenv cn =
(** return true if [field_name] is the autogenerated C.$assertionsDisabled field for class C *) (** return true if [field_name] is the autogenerated C.$assertionsDisabled field for class C *)
let is_autogenerated_assert_field field_name = let is_autogenerated_assert_field field_name =
String.equal (Typ.Fieldname.java_get_field field_name) "$assertionsDisabled" String.equal (Typ.Fieldname.Java.get_field field_name) "$assertionsDisabled"
(** translate an object type *) (** translate an object type *)

@ -44,7 +44,7 @@ module TransferFunctions (CFG : ProcCfg.S) = struct
false false
in in
PatternMatch.supertype_exists tenv is_closable_interface PatternMatch.supertype_exists tenv is_closable_interface
(Typ.Name.Java.from_string (Typ.Procname.java_get_class_name java_procname)) (Typ.Name.Java.from_string (Typ.Procname.Java.get_class_name java_procname))
| _ -> | _ ->
false false
in in

@ -45,8 +45,8 @@ include TaintAnalysis.Make (struct
-> ( -> (
let is_static = Typ.Procname.java_is_static pname in let is_static = Typ.Procname.java_is_static pname in
match match
( Typ.Procname.java_get_class_name java_pname ( Typ.Procname.Java.get_class_name java_pname
, Typ.Procname.java_get_method java_pname , Typ.Procname.Java.get_method java_pname
, ret_typ_opt ) , ret_typ_opt )
with with
| "android.content.Intent", ("putExtra" | "putExtras"), _ -> | "android.content.Intent", ("putExtra" | "putExtras"), _ ->

@ -62,7 +62,7 @@ module SourceKind = struct
let return = None in let return = None in
match pname with match pname with
| Typ.Procname.Java pname -> ( | Typ.Procname.Java pname -> (
match (Typ.Procname.java_get_class_name pname, Typ.Procname.java_get_method pname) with match (Typ.Procname.Java.get_class_name pname, Typ.Procname.Java.get_method pname) with
| "android.content.Intent", "<init>" when actual_has_type 2 "android.net.Uri" actuals tenv -> | "android.content.Intent", "<init>" when actual_has_type 2 "android.net.Uri" actuals tenv ->
(* taint the [this] parameter passed to the constructor *) (* taint the [this] parameter passed to the constructor *)
Some (IntentFromURI, Some 0) Some (IntentFromURI, Some 0)
@ -154,7 +154,7 @@ module SourceKind = struct
match Procdesc.get_proc_name pdesc with match Procdesc.get_proc_name pdesc with
| Typ.Procname.Java java_pname -> ( | Typ.Procname.Java java_pname -> (
match match
(Typ.Procname.java_get_class_name java_pname, Typ.Procname.java_get_method java_pname) (Typ.Procname.Java.get_class_name java_pname, Typ.Procname.Java.get_method java_pname)
with with
| "codetoanalyze.java.quandary.TaintedFormals", "taintedContextBad" -> | "codetoanalyze.java.quandary.TaintedFormals", "taintedContextBad" ->
taint_formals_with_types ["java.lang.Integer"; "java.lang.String"] Other formals taint_formals_with_types ["java.lang.Integer"; "java.lang.String"] Other formals
@ -298,7 +298,7 @@ module SinkKind = struct
match pname with match pname with
| Typ.Procname.Java java_pname -> ( | Typ.Procname.Java java_pname -> (
match match
(Typ.Procname.java_get_class_name java_pname, Typ.Procname.java_get_method java_pname) (Typ.Procname.Java.get_class_name java_pname, Typ.Procname.Java.get_method java_pname)
with with
| "android.text.Html", "fromHtml" -> | "android.text.Html", "fromHtml" ->
taint_nth 0 HTML taint_nth 0 HTML
@ -424,8 +424,8 @@ module JavaSanitizer = struct
| Typ.Procname.Java java_pname -> | Typ.Procname.Java java_pname ->
let procedure_string = let procedure_string =
Printf.sprintf "%s.%s" Printf.sprintf "%s.%s"
(Typ.Procname.java_get_class_name java_pname) (Typ.Procname.Java.get_class_name java_pname)
(Typ.Procname.java_get_method java_pname) (Typ.Procname.Java.get_method java_pname)
in in
List.find_map List.find_map
~f:(fun procedure_regex -> ~f:(fun procedure_regex ->

@ -121,7 +121,7 @@ module Make (TaintSpecification : TaintSpec.S) = struct
let is_endpoint source = let is_endpoint source =
match CallSite.pname (TraceDomain.Source.call_site source) with match CallSite.pname (TraceDomain.Source.call_site source) with
| Typ.Procname.Java java_pname -> | Typ.Procname.Java java_pname ->
String.Set.mem (Lazy.force endpoints) (Typ.Procname.java_get_class_name java_pname) String.Set.mem (Lazy.force endpoints) (Typ.Procname.Java.get_class_name java_pname)
| _ -> | _ ->
false false
@ -519,7 +519,7 @@ module Make (TaintSpecification : TaintSpec.S) = struct
let is_variadic = let is_variadic =
match callee_pname with match callee_pname with
| Typ.Procname.Java pname -> ( | Typ.Procname.Java pname -> (
match List.rev (Typ.Procname.java_get_parameters pname) with match List.rev (Typ.Procname.Java.get_parameters pname) with
| (_, "java.lang.Object[]") :: _ -> | (_, "java.lang.Object[]") :: _ ->
true true
| _ -> | _ ->

Loading…
Cancel
Save