[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."
MF.pp_monospaced "@ThreadSafe")
else
match get_current_class_and_threadsafe_superclasses tenv pname with
| Some (current_class, (thread_safe_class :: _ as thread_safe_annotated_classes)) ->
Some
( if List.mem ~equal:Typ.Name.equal thread_safe_annotated_classes current_class then
F.asprintf "@\n Reporting because the current class is annotated %a"
MF.pp_monospaced "@ThreadSafe"
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
match FbThreadSafety.get_fbthreadsafe_class_annot pname tenv with
| Some (qual, annot) ->
Some (FbThreadSafety.message_fbthreadsafe_class qual annot)
| None ->
match get_current_class_and_threadsafe_superclasses tenv pname with
| Some (current_class, (thread_safe_class :: _ as thread_safe_annotated_classes)) ->
Some
( if List.mem ~equal:Typ.Name.equal thread_safe_annotated_classes current_class then
F.asprintf "@\n Reporting because the current class is annotated %a"
MF.pp_monospaced "@ThreadSafe"
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
match (report_kind, annotation_explanation_opt) with
| UnannotatedInterface, Some threadsafe_explanation ->
@ -1714,4 +1719,3 @@ let file_analysis {Callbacks.procedures} =
else (module MayAliasQuotientedAccessListMap) )
class_env))
(aggregate_by_class procedures)

@ -12,3 +12,7 @@ open! IStd
let is_custom_init _ _ = 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_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