[infer][java] Minor cleanup of the Java frontend

Reviewed By: sblackshear

Differential Revision: D4053975

fbshipit-source-id: 31294e8
master
Jeremy Dubreil 8 years ago committed by Facebook Github Bot
parent c2a8dae26f
commit d891303bb6

@ -201,6 +201,7 @@ val frontend_stats : bool
val headers : bool val headers : bool
val infer_cache : string option val infer_cache : string option
val iterations : int val iterations : int
val java_jar_compiler : string option
val javac_verbose_out : string val javac_verbose_out : string
val jobs : int val jobs : int
val join_cond : int val join_cond : int
@ -270,7 +271,6 @@ val write_html : bool
val xcode_developer_dir : string option val xcode_developer_dir : string option
val xml_specs : bool val xml_specs : bool
val zip_libraries : zip_library list val zip_libraries : zip_library list
val java_jar_compiler : string option
(** Global variables *) (** Global variables *)

@ -15,11 +15,15 @@ open Javalib_pack
module L = Logging module L = Logging
let () = let () =
(match Config.models_file with Some file -> JClasspath.add_models file | None -> ()); match Config.models_file with
if Config.models_mode && !JClasspath.models_jar <> "" then | None when Config.models_mode ->
failwith "Not expecting model file when analyzing the models"; ()
if not Config.models_mode && !JClasspath.models_jar = "" then | None ->
failwith "Java model file is required" 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 = 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 *) (* load a stored global tenv if the file is found, and create a new one otherwise *)
let load_tenv () = let load_tenv () =
if DB.file_exists DB.global_tenv_fname then
begin
match Tenv.load_from_file DB.global_tenv_fname with match Tenv.load_from_file DB.global_tenv_fname with
| None -> | None ->
Tenv.create () Tenv.create ()
| Some _ when Config.models_mode -> | Some _ when Config.models_mode ->
let error_msg = failwithf
"Unexpected tenv file " "Unexpected tenv file %s found while generating the models"
^ (DB.filename_to_string DB.global_tenv_fname) (DB.filename_to_string DB.global_tenv_fname)
^ " found while generating the models" in
failwith error_msg
| Some tenv -> | Some tenv ->
tenv tenv
end
else
Tenv.create ()
(* Store to a file the type environment containing all the types required to perform the analysis *) (* Store to a file the type environment containing all the types required to perform the analysis *)

@ -1154,10 +1154,3 @@ let rec instruction (context : JContext.t) pc instr : translation =
with Frontend_error s -> with Frontend_error s ->
JUtils.log "Skipping because of: %s@." s; JUtils.log "Skipping because of: %s@." s;
Skip 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)
*)

@ -267,8 +267,8 @@ let add_model_fields program classpath_fields cn =
(collect_models_class_fields classpath_field_map cn) (collect_models_class_fields classpath_field_map cn)
jclass jclass
classpath_fields classpath_fields
| _ ->
| _ -> classpath_fields classpath_fields
with Not_found -> classpath_fields with Not_found -> classpath_fields

Loading…
Cancel
Save