[infer][java] translate the name of the field when the class is not found

Reviewed By: mbouaziz, ngorogiannis

Differential Revision: D9477069

fbshipit-source-id: 61efd7ae4
master
Jeremy Dubreil 6 years ago committed by Facebook Github Bot
parent a3753885bb
commit 5e2fcd62d4

@ -87,9 +87,8 @@ let get_field_name program static tenv cn fs =
| Some (fieldname, _, _) ->
fieldname
| None ->
(* TODO: understand why fields cannot be found here *)
L.internal_error "cannot find %s.%s@." (JBasics.cn_name cn) (JBasics.fs_name fs) ;
raise (Frontend_error "Cannot find fieldname")
(* TODO (T28155039): understand why fields cannot be found here *)
JTransType.create_fieldname cn fs
let formals_from_signature program tenv cn ms kind =

@ -216,14 +216,14 @@ let get_method_kind m =
if Javalib.is_static_method m then Typ.Procname.Java.Static else Typ.Procname.Java.Non_Static
let fieldname_create cn fs =
let create_fieldname cn fs =
let fieldname = JBasics.fs_name fs in
let classname = JBasics.cn_name cn in
Typ.Fieldname.Java.from_string (classname ^ "." ^ fieldname)
let create_sil_class_field cn {Javalib.cf_signature; cf_annotations; cf_kind} =
let field_name = fieldname_create cn cf_signature
let field_name = create_fieldname cn cf_signature
and field_type = get_named_type (JBasics.fs_type cf_signature)
and annotation =
let real_annotations = JAnnotation.translate_item cf_annotations in
@ -250,7 +250,7 @@ let collect_class_field cn cf (statics, nonstatics) =
let collect_interface_field cn inf l =
let fs = inf.Javalib.if_signature in
let field_type = get_named_type (JBasics.fs_type fs) in
let field_name = fieldname_create cn fs in
let field_name = create_fieldname cn fs in
let annotation = JAnnotation.translate_item inf.Javalib.if_annotations in
(field_name, field_type, annotation) :: l

@ -10,6 +10,9 @@ open! IStd
open Javalib_pack
open Sawja_pack
val create_fieldname : JBasics.class_name -> JBasics.field_signature -> Typ.Fieldname.t
(** translate the name of the field *)
val get_method_kind : JCode.jcode Javalib.jmethod -> Typ.Procname.Java.kind
val get_method_procname :
@ -19,7 +22,7 @@ val get_method_procname :
-> JBasics.method_signature
-> Typ.Procname.Java.kind
-> Typ.Procname.t
(** returns a procedure name based on the class name and the method's signature. *)
(** returns a procedure name based on the class name and the method's signature *)
val translate_method_name :
JClasspath.program -> Tenv.t -> JCode.jcode Javalib.jmethod -> Typ.Procname.t

Loading…
Cancel
Save