diff --git a/infer/src/base/Config.mli b/infer/src/base/Config.mli index a276f639c..f162bdc54 100644 --- a/infer/src/base/Config.mli +++ b/infer/src/base/Config.mli @@ -201,6 +201,7 @@ val frontend_stats : bool val headers : bool val infer_cache : string option val iterations : int +val java_jar_compiler : string option val javac_verbose_out : string val jobs : int val join_cond : int @@ -270,7 +271,6 @@ val write_html : bool val xcode_developer_dir : string option val xml_specs : bool val zip_libraries : zip_library list -val java_jar_compiler : string option (** Global variables *) diff --git a/infer/src/java/jMain.ml b/infer/src/java/jMain.ml index 0a2fa27d5..4a5d58cb2 100644 --- a/infer/src/java/jMain.ml +++ b/infer/src/java/jMain.ml @@ -15,11 +15,15 @@ open Javalib_pack module L = Logging let () = - (match Config.models_file with Some file -> JClasspath.add_models file | None -> ()); - if Config.models_mode && !JClasspath.models_jar <> "" then - failwith "Not expecting model file when analyzing the models"; - if not Config.models_mode && !JClasspath.models_jar = "" then - failwith "Java model file is required" + match Config.models_file with + | None when Config.models_mode -> + () + | None -> + failwith "Java model file is required" + | Some _ when Config.models_mode -> + failwith "Not expecting model file when analyzing the models"; + | Some file -> + JClasspath.add_models file let register_perf_stats_report source_file = @@ -91,22 +95,15 @@ let capture_libs linereader program tenv = (* load a stored global tenv if the file is found, and create a new one otherwise *) let load_tenv () = - if DB.file_exists DB.global_tenv_fname then - begin - match Tenv.load_from_file DB.global_tenv_fname with - | None -> - Tenv.create () - | Some _ when Config.models_mode -> - let error_msg = - "Unexpected tenv file " - ^ (DB.filename_to_string DB.global_tenv_fname) - ^ " found while generating the models" in - failwith error_msg - | Some tenv -> - tenv - end - else - Tenv.create () + match Tenv.load_from_file DB.global_tenv_fname with + | None -> + Tenv.create () + | Some _ when Config.models_mode -> + failwithf + "Unexpected tenv file %s found while generating the models" + (DB.filename_to_string DB.global_tenv_fname) + | Some tenv -> + tenv (* Store to a file the type environment containing all the types required to perform the analysis *) diff --git a/infer/src/java/jTrans.ml b/infer/src/java/jTrans.ml index cfa1689fc..e8059df27 100644 --- a/infer/src/java/jTrans.ml +++ b/infer/src/java/jTrans.ml @@ -1154,10 +1154,3 @@ let rec instruction (context : JContext.t) pc instr : translation = with Frontend_error s -> JUtils.log "Skipping because of: %s@." s; Skip - -(* -let static_field_name cn fs = - let classname = JBasics.cn_name cn in - let fieldname = JBasics.fs_name fs in - Mangled.from_string (classname^"."^fieldname) -*) diff --git a/infer/src/java/jTransType.ml b/infer/src/java/jTransType.ml index 49f4945e5..b7ea3962a 100644 --- a/infer/src/java/jTransType.ml +++ b/infer/src/java/jTransType.ml @@ -267,8 +267,8 @@ let add_model_fields program classpath_fields cn = (collect_models_class_fields classpath_field_map cn) jclass classpath_fields - - | _ -> classpath_fields + | _ -> + classpath_fields with Not_found -> classpath_fields