[java] introduce flag controlling masking of sawja exceptions

Summary: Purpose is to be able to write tests for failure cases.

Reviewed By: jvillard

Differential Revision: D29364785

fbshipit-source-id: 734be7826
master
Nikos Gorogiannis 3 years ago committed by Facebook GitHub Bot
parent db0ca12d93
commit c423b0d6a6

@ -310,6 +310,10 @@ JAVA OPTIONS
The version of Java being used. Set it to your Java version if mvn The version of Java being used. Set it to your Java version if mvn
is failing. is failing.
--no-mask-sawja-exceptions
Deactivates: Mask exceptions thrown by Sawja/Javalib during Java
capture (Conversely: --mask-sawja-exceptions)
ENVIRONMENT ENVIRONMENT
INFER_ARGS, INFERCONFIG, INFER_STRICT_MODE INFER_ARGS, INFERCONFIG, INFER_STRICT_MODE

@ -885,6 +885,10 @@ OPTIONS
Activates: Enable loop-hoisting and disable all other checkers Activates: Enable loop-hoisting and disable all other checkers
(Conversely: --no-loop-hoisting-only) See also infer-analyze(1). (Conversely: --no-loop-hoisting-only) See also infer-analyze(1).
--no-mask-sawja-exceptions
Deactivates: Mask exceptions thrown by Sawja/Javalib during Java
capture (Conversely: --mask-sawja-exceptions) See also infer-capture(1).
--max-jobs int --max-jobs int
Maximum number of analysis jobs running simultaneously Maximum number of analysis jobs running simultaneously
See also infer-analyze(1). See also infer-analyze(1).

@ -885,6 +885,10 @@ OPTIONS
Activates: Enable loop-hoisting and disable all other checkers Activates: Enable loop-hoisting and disable all other checkers
(Conversely: --no-loop-hoisting-only) See also infer-analyze(1). (Conversely: --no-loop-hoisting-only) See also infer-analyze(1).
--no-mask-sawja-exceptions
Deactivates: Mask exceptions thrown by Sawja/Javalib during Java
capture (Conversely: --mask-sawja-exceptions) See also infer-capture(1).
--max-jobs int --max-jobs int
Maximum number of analysis jobs running simultaneously Maximum number of analysis jobs running simultaneously
See also infer-analyze(1). See also infer-analyze(1).

@ -1733,6 +1733,12 @@ and margin =
"Set right margin for the pretty printing functions" "Set right margin for the pretty printing functions"
and mask_sajwa_exceptions =
CLOpt.mk_bool ~long:"mask-sawja-exceptions" ~default:true
~in_help:InferCommand.[(Capture, manual_java)]
"Mask exceptions thrown by Sawja/Javalib during Java capture"
and max_jobs = and max_jobs =
CLOpt.mk_int_opt ~long:"max-jobs" CLOpt.mk_int_opt ~long:"max-jobs"
~in_help:InferCommand.[(Analyze, manual_generic)] ~in_help:InferCommand.[(Analyze, manual_generic)]
@ -3197,6 +3203,8 @@ and load_average =
match !load_average with None when !buck -> Some (float_of_int ncpu) | _ -> !load_average match !load_average with None when !buck -> Some (float_of_int ncpu) | _ -> !load_average
and mask_sajwa_exceptions = !mask_sajwa_exceptions
and max_nesting = !max_nesting and max_nesting = !max_nesting
and memtrace_analysis = !memtrace_analysis and memtrace_analysis = !memtrace_analysis

@ -407,6 +407,8 @@ val liveness_ignored_constant : string list
val load_average : float option val load_average : float option
val mask_sajwa_exceptions : bool
val max_nesting : int option val max_nesting : int option
val memtrace_analysis : bool val memtrace_analysis : bool

@ -465,7 +465,7 @@ let create_cm_procdesc source_file program icfg cm proc_name =
Procdesc.set_start_node procdesc start_node ; Procdesc.set_start_node procdesc start_node ;
Procdesc.set_exit_node procdesc exit_node ; Procdesc.set_exit_node procdesc exit_node ;
Some (procdesc, start_node, exit_node, exn_node, jbir_code) Some (procdesc, start_node, exit_node, exn_node, jbir_code)
with JBir.Subroutine -> with JBir.Subroutine when Config.mask_sajwa_exceptions ->
L.internal_error "create_procdesc raised JBir.Subroutine when translating %a in %a@." L.internal_error "create_procdesc raised JBir.Subroutine when translating %a in %a@."
Procname.pp proc_name SourceFile.pp source_file ; Procname.pp proc_name SourceFile.pp source_file ;
None None

Loading…
Cancel
Save