58
58
#include < java_bytecode/remove_instanceof.h>
59
59
#include < java_bytecode/remove_java_new.h>
60
60
#include < java_bytecode/replace_java_nondet.h>
61
+ #include < java_bytecode/simple_method_stubbing.h>
61
62
62
63
#include < cbmc/version.h>
63
64
@@ -522,6 +523,21 @@ int jbmc_parse_optionst::doit()
522
523
};
523
524
}
524
525
526
+ object_factory_params.max_nondet_array_length =
527
+ cmdline.isset (" java-max-input-array-length" )
528
+ ? std::stoul (cmdline.get_value (" java-max-input-array-length" ))
529
+ : MAX_NONDET_ARRAY_LENGTH_DEFAULT;
530
+ object_factory_params.max_nondet_string_length =
531
+ cmdline.isset (" string-max-input-length" )
532
+ ? std::stoul (cmdline.get_value (" string-max-input-length" ))
533
+ : MAX_NONDET_STRING_LENGTH;
534
+ object_factory_params.max_nondet_tree_depth =
535
+ cmdline.isset (" java-max-input-tree-depth" )
536
+ ? std::stoul (cmdline.get_value (" java-max-input-tree-depth" ))
537
+ : MAX_NONDET_TREE_DEPTH;
538
+
539
+ stub_objects_are_not_null = cmdline.isset (" java-assume-inputs-non-null" );
540
+
525
541
if (!cmdline.isset (" symex-driven-lazy-loading" ))
526
542
{
527
543
std::unique_ptr<goto_modelt> goto_model_ptr;
@@ -757,23 +773,11 @@ void jbmc_parse_optionst::process_goto_function(
757
773
replace_java_nondet (function);
758
774
759
775
// Similar removal of java nondet statements:
760
- // TODO Should really get this from java_bytecode_language somehow, but we
761
- // don't have an instance of that here.
762
- object_factory_parameterst factory_params;
763
- factory_params.max_nondet_array_length =
764
- cmdline.isset (" java-max-input-array-length" )
765
- ? std::stoul (cmdline.get_value (" java-max-input-array-length" ))
766
- : MAX_NONDET_ARRAY_LENGTH_DEFAULT;
767
- factory_params.max_nondet_string_length =
768
- cmdline.isset (" string-max-input-length" )
769
- ? std::stoul (cmdline.get_value (" string-max-input-length" ))
770
- : MAX_NONDET_STRING_LENGTH;
771
- factory_params.max_nondet_tree_depth =
772
- cmdline.isset (" java-max-input-tree-depth" )
773
- ? std::stoul (cmdline.get_value (" java-max-input-tree-depth" ))
774
- : MAX_NONDET_TREE_DEPTH;
775
-
776
- convert_nondet (function, get_message_handler (), factory_params, ID_java);
776
+ convert_nondet (
777
+ function,
778
+ get_message_handler (),
779
+ object_factory_params,
780
+ ID_java);
777
781
778
782
// add generic checks
779
783
goto_check (ns, options, ID_java, function.get_goto_function ());
@@ -1014,7 +1018,7 @@ bool jbmc_parse_optionst::process_goto_functions(
1014
1018
1015
1019
bool jbmc_parse_optionst::can_generate_function_body (const irep_idt &name)
1016
1020
{
1017
- return false ;
1021
+ return true ;
1018
1022
}
1019
1023
1020
1024
bool jbmc_parse_optionst::generate_function_body (
@@ -1023,7 +1027,27 @@ bool jbmc_parse_optionst::generate_function_body(
1023
1027
goto_functiont &function,
1024
1028
bool body_available)
1025
1029
{
1026
- return false ;
1030
+ // Provide a simple stub implementation for any function we don't have a
1031
+ // bytecode implementation for:
1032
+
1033
+ if (!body_available && symbol_table.lookup_ref (function_name).mode == ID_java)
1034
+ {
1035
+ java_generate_simple_method_stub (
1036
+ function_name,
1037
+ symbol_table,
1038
+ stub_objects_are_not_null,
1039
+ object_factory_params,
1040
+ get_message_handler ());
1041
+
1042
+ goto_convert_functionst converter (symbol_table, get_message_handler ());
1043
+ converter.convert_function (function_name, function);
1044
+
1045
+ return true ;
1046
+ }
1047
+ else
1048
+ {
1049
+ return false ;
1050
+ }
1027
1051
}
1028
1052
1029
1053
// / display command line help
0 commit comments