@ -101,7 +101,6 @@ let mk_coming_from nullsafe_mode nullability =
let mk_recommendation nullsafe_mode nullability what =
let mk_recommendation nullsafe_mode nullability what =
match ( nullsafe_mode , nullability ) with
match ( nullsafe_mode , nullability ) with
| NullsafeMode . Strict , Nullability . ThirdPartyNonnull
| NullsafeMode . Strict , Nullability . UncheckedNonnull
| NullsafeMode . Strict , Nullability . UncheckedNonnull
| NullsafeMode . Strict , Nullability . LocallyCheckedNonnull ->
| NullsafeMode . Strict , Nullability . LocallyCheckedNonnull ->
Some ( F . sprintf " make %s nullsafe strict " what )
Some ( F . sprintf " make %s nullsafe strict " what )
@ -130,29 +129,34 @@ let get_info object_origin nullsafe_mode bad_nullability =
( Procname . to_simplified_string ~ withclass : true pname )
( Procname . to_simplified_string ~ withclass : true pname )
in
in
let object_loc = call_loc in
let object_loc = call_loc in
let what_is_used = " Result of this call " in
let + coming_from_explanation , recommendation , issue_type =
match bad_nullability with
| Nullability . Null | Nullability . Nullable ->
(* This method makes sense only for non-nullable violations *)
None
| Nullability . StrictNonnull ->
(* This method makes sense only for non-nullable violations *)
Logging . die InternalError " There should not be type violations involving StrictNonnull "
| Nullability . ThirdPartyNonnull ->
let suggested_third_party_sig_file =
let suggested_third_party_sig_file =
ThirdPartyAnnotationInfo . lookup_related_sig_file_for_proc
ThirdPartyAnnotationInfo . lookup_related_sig_file_for_proc
( ThirdPartyAnnotationGlobalRepo . get_repo () )
( ThirdPartyAnnotationGlobalRepo . get_repo () )
pname
pname
in
in
let what_is_used = " Result of this call " in
let where_to_add_signature =
(* Two main cases: it is either FB owned code or third party.
Option . value_map suggested_third_party_sig_file
We determine the difference based on presense of suggested_third_party_sig_file .
~ f : ( fun sig_file_name ->
* )
ThirdPartyAnnotationGlobalRepo . get_user_friendly_third_party_sig_file_name
let + coming_from_explanation , recommendation , issue_type =
~ filename : sig_file_name )
match suggested_third_party_sig_file with
(* this can happen when third party is registered in a deprecated way ( not in third party repository ) *)
| Some sig_file_name ->
~ default : " the third party signature storage "
(* Dereferences or assignment violations with regular Nullables
in
should not be special cased * )
if Nullability . equal Nullable bad_nullability then None
else
return
return
( " not vetted third party methods "
( " not vetted third party methods "
, F . sprintf " add the correct signature to %s "
, F . sprintf " add the correct signature to %s " where_to_add_signature
( ThirdPartyAnnotationGlobalRepo . get_user_friendly_third_party_sig_file_name
~ filename : sig_file_name )
, IssueType . eradicate_unvetted_third_party_in_nullsafe )
, IssueType . eradicate_unvetted_third_party_in_nullsafe )
| None ->
| Nullability . UncheckedNonnull | Nullability . LocallyCheckedNonnull ->
let * from = mk_coming_from nullsafe_mode bad_nullability in
let * from = mk_coming_from nullsafe_mode bad_nullability in
let + recommendation =
let + recommendation =
let what_to_strictify =
let what_to_strictify =