diff --git a/infer/src/java/jTrans.ml b/infer/src/java/jTrans.ml index d9cd05e1c..66d21fda4 100644 --- a/infer/src/java/jTrans.ml +++ b/infer/src/java/jTrans.ml @@ -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 = diff --git a/infer/src/java/jTransType.ml b/infer/src/java/jTransType.ml index 7156b85be..3387d1e54 100644 --- a/infer/src/java/jTransType.ml +++ b/infer/src/java/jTransType.ml @@ -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 diff --git a/infer/src/java/jTransType.mli b/infer/src/java/jTransType.mli index 2bee21cd6..da34a79bf 100644 --- a/infer/src/java/jTransType.mli +++ b/infer/src/java/jTransType.mli @@ -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