[nullsafe][refactor] Migrate DereferenceRule to Procname.Java.t

Summary:
This is part of work aimed to reduce number of language-agnostic methods
used in Nullsafe codebase.

Reviewed By: artempyanykh

Differential Revision: D23052328

fbshipit-source-id: 2b69f5f7a
master
Mitya Lyubarskiy 4 years ago committed by Facebook GitHub Bot
parent 80c31ab8da
commit d4bea60440

@ -108,6 +108,8 @@ module Java = struct
F.fprintf fmt "%a(%s)" pp_method_name j params
let to_simplified_string ?(withclass = false) = Pp.string_of_pp (pp ~withclass Simple)
let get_return_typ pname_java = Option.value ~default:Typ.void pname_java.return_type
let is_close {method_name} = String.equal method_name "close"

@ -19,6 +19,8 @@ module Java : sig
type t [@@deriving compare]
val to_simplified_string : ?withclass:bool -> t -> string
val constructor_method_name : string
val class_initializer_method_name : string

@ -12,7 +12,7 @@ module ReportableViolation = struct
type t = {nullsafe_mode: NullsafeMode.t; violation: violation}
type dereference_type =
| MethodCall of Procname.t
| MethodCall of Procname.Java.t
| AccessToField of Fieldname.t
| AccessByIndex of {index_desc: string}
| ArrayLengthAccess
@ -61,7 +61,7 @@ module ReportableViolation = struct
match dereference_type with
| MethodCall method_name ->
Format.sprintf "calling %s"
(MF.monospaced_to_string (Procname.to_simplified_string method_name))
(MF.monospaced_to_string (Procname.Java.to_simplified_string method_name))
| AccessToField field_name ->
Format.sprintf "accessing field %s"
(MF.monospaced_to_string (Fieldname.to_simplified_string field_name))

@ -21,7 +21,7 @@ module ReportableViolation : sig
type t
type dereference_type =
| MethodCall of Procname.t
| MethodCall of Procname.Java.t
| AccessToField of Fieldname.t
| AccessByIndex of {index_desc: string}
| ArrayLengthAccess

@ -1058,7 +1058,7 @@ let calc_typestate_after_call
if not is_anonymous_inner_class_constructor then (
if cflags.CallFlags.cf_virtual && checks.eradicate then
EradicateChecks.check_call_receiver analysis_data ~nullsafe_mode find_canonical_duplicate
node typestate1 call_params callee_pname instr_ref loc
node typestate1 call_params callee_pname_java instr_ref loc
(typecheck_expr analysis_data ~nullsafe_mode find_canonical_duplicate calls_this checks) ;
if checks.eradicate then
EradicateChecks.check_call_parameters analysis_data ~nullsafe_mode

Loading…
Cancel
Save