[racerd] specialized error message for races involving litho components

Reviewed By: sblackshear

Differential Revision: D6339365

fbshipit-source-id: 9f63f71
master
Peter O'Hearn 7 years ago committed by Facebook Github Bot
parent d90bc24657
commit e7d9223597

@ -1005,17 +1005,22 @@ let get_reporting_explanation_java report_kind tenv pname thread =
"@\n Reporting because current method is annotated %a or overrides an annotated method." "@\n Reporting because current method is annotated %a or overrides an annotated method."
MF.pp_monospaced "@ThreadSafe") MF.pp_monospaced "@ThreadSafe")
else else
match get_current_class_and_threadsafe_superclasses tenv pname with match FbThreadSafety.get_fbthreadsafe_class_annot pname tenv with
| Some (current_class, (thread_safe_class :: _ as thread_safe_annotated_classes)) -> | Some (qual, annot) ->
Some Some (FbThreadSafety.message_fbthreadsafe_class qual annot)
( if List.mem ~equal:Typ.Name.equal thread_safe_annotated_classes current_class then | None ->
F.asprintf "@\n Reporting because the current class is annotated %a" match get_current_class_and_threadsafe_superclasses tenv pname with
MF.pp_monospaced "@ThreadSafe" | Some (current_class, (thread_safe_class :: _ as thread_safe_annotated_classes)) ->
else Some
F.asprintf "@\n Reporting because a superclass %a is annotated %a" ( if List.mem ~equal:Typ.Name.equal thread_safe_annotated_classes current_class then
(MF.wrap_monospaced Typ.Name.pp) thread_safe_class MF.pp_monospaced "@ThreadSafe" ) F.asprintf "@\n Reporting because the current class is annotated %a"
| _ -> MF.pp_monospaced "@ThreadSafe"
None else
F.asprintf "@\n Reporting because a superclass %a is annotated %a"
(MF.wrap_monospaced Typ.Name.pp) thread_safe_class MF.pp_monospaced "@ThreadSafe"
)
| _ ->
None
in in
match (report_kind, annotation_explanation_opt) with match (report_kind, annotation_explanation_opt) with
| UnannotatedInterface, Some threadsafe_explanation -> | UnannotatedInterface, Some threadsafe_explanation ->
@ -1714,4 +1719,3 @@ let file_analysis {Callbacks.procedures} =
else (module MayAliasQuotientedAccessListMap) ) else (module MayAliasQuotientedAccessListMap) )
class_env)) class_env))
(aggregate_by_class procedures) (aggregate_by_class procedures)

@ -12,3 +12,7 @@ open! IStd
let is_custom_init _ _ = false let is_custom_init _ _ = false
let is_logging_method _ = false let is_logging_method _ = false
let get_fbthreadsafe_class_annot _ _ = None
let message_fbthreadsafe_class _ _ = ""

@ -12,3 +12,7 @@ open! IStd
val is_custom_init : Tenv.t -> Typ.Procname.t -> bool val is_custom_init : Tenv.t -> Typ.Procname.t -> bool
val is_logging_method : Typ.Procname.t -> bool val is_logging_method : Typ.Procname.t -> bool
val get_fbthreadsafe_class_annot : Typ.Procname.t -> Tenv.t -> (string * string) option
val message_fbthreadsafe_class : string -> string -> string

Loading…
Cancel
Save