diff --git a/infer/src/IR/Procname.ml b/infer/src/IR/Procname.ml index 280d0b77d..e57383eb5 100644 --- a/infer/src/IR/Procname.ml +++ b/infer/src/IR/Procname.ml @@ -178,7 +178,9 @@ module Java = struct false - let is_autogen_method {method_name} = String.contains method_name '$' + let is_autogen_method_name method_name = String.contains method_name '$' + + let is_autogen_method {method_name} = is_autogen_method_name method_name (** Check if the proc name has the type of a java vararg. Note: currently only checks that the last argument has type Object[]. *) diff --git a/infer/src/IR/Procname.mli b/infer/src/IR/Procname.mli index 63ad63030..a61404600 100644 --- a/infer/src/IR/Procname.mli +++ b/infer/src/IR/Procname.mli @@ -65,6 +65,9 @@ module Java : sig val is_autogen_method : t -> bool (** Check if the procedure name is of an auto-generated method containing '$'. *) + val is_autogen_method_name : string -> bool + (** Check if the string of procedure name is of an auto-generated method containing '$'. *) + val is_anonymous_inner_class_constructor_exn : t -> bool (** Check if the procedure name is an anonymous inner class constructor. Throws if it is not a Java type *) diff --git a/infer/src/backend/Differential.ml b/infer/src/backend/Differential.ml index df4110c10..3d429b7c8 100644 --- a/infer/src/backend/Differential.ml +++ b/infer/src/backend/Differential.ml @@ -260,14 +260,21 @@ let issue_of_cost kind CostIssues.{complexity_increase_issue; unreachable_issue; Format.asprintf "%a %t %s" MarkupFormatter.pp_bold "This function is called during cold start!" pp_avg_inclusive_time common_msg ) in - let msg = + let msg f = (* Java Only *) - if String.equal method_name Procname.Java.constructor_method_name then "constructor" + if String.equal method_name Procname.Java.constructor_method_name then + Format.pp_print_string f "constructor" else if String.equal method_name Procname.Java.class_initializer_method_name then - "class initializer" - else "this function" + Format.pp_print_string f "class initializer" + else + Format.fprintf f "%t%a" + (fun f -> + if Procname.Java.is_autogen_method_name method_name then + Format.pp_print_string f "auto-generated method " ) + (MarkupFormatter.wrap_monospaced Format.pp_print_string) + method_name in - Format.asprintf "%s of %s has %a from %a to %a. %s %a" + Format.asprintf "%s of %t has %a from %a to %a. %s %a" (CostKind.to_complexity_string kind) msg (MarkupFormatter.wrap_bold pp_delta)