From 332bd365e8404f3d6987448b450aa595c349339f Mon Sep 17 00:00:00 2001 From: Nikos Gorogiannis Date: Wed, 1 Aug 2018 07:42:00 -0700 Subject: [PATCH] [starvation] fix report string when class is annotated @UIThread Summary: The current message is confusing when the current class is marked UIThread. See picture attached to task. Reviewed By: jeremydubreil Differential Revision: D8996593 fbshipit-source-id: cf52ee5d6 --- infer/src/concurrency/RacerDConfig.ml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/infer/src/concurrency/RacerDConfig.ml b/infer/src/concurrency/RacerDConfig.ml index 6fb5f9d2a..9c242b2f7 100644 --- a/infer/src/concurrency/RacerDConfig.ml +++ b/infer/src/concurrency/RacerDConfig.ml @@ -540,11 +540,15 @@ module Models = struct (F.asprintf "class %s extends %s" (MF.monospaced_to_string (Typ.Name.name current_class)) (MF.monospaced_to_string "android.app.Service")) - | Some (current_class, super_class :: _) -> + | Some (current_class, (super_class :: _ as super_classes)) -> + let middle = + if List.exists super_classes ~f:(Typ.Name.equal current_class) then "" + else F.asprintf " extends %a, which" (MF.wrap_monospaced Typ.Name.pp) super_class + in Some - (F.asprintf "class %s extends %a, which is annotated %s" + (F.asprintf "class %s%s is annotated %s" (MF.monospaced_to_string (Typ.Name.name current_class)) - (MF.wrap_monospaced Typ.Name.pp) super_class + middle (MF.monospaced_to_string Annotations.ui_thread)) | _ -> None