[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 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 *)

@ -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 *)

@ -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)
*)

@ -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

Loading…
Cancel
Save