5858#include < java_bytecode/remove_instanceof.h>
5959#include < java_bytecode/remove_java_new.h>
6060#include < java_bytecode/replace_java_nondet.h>
61+ #include < java_bytecode/simple_method_stubbing.h>
6162
6263#include < cbmc/version.h>
6364
@@ -522,6 +523,21 @@ int jbmc_parse_optionst::doit()
522523 };
523524 }
524525
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+
525541 if (!cmdline.isset (" symex-driven-lazy-loading" ))
526542 {
527543 std::unique_ptr<goto_modelt> goto_model_ptr;
@@ -757,23 +773,11 @@ void jbmc_parse_optionst::process_goto_function(
757773 replace_java_nondet (function);
758774
759775 // 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);
777781
778782 // add generic checks
779783 goto_check (ns, options, ID_java, function.get_goto_function ());
@@ -1014,7 +1018,7 @@ bool jbmc_parse_optionst::process_goto_functions(
10141018
10151019bool jbmc_parse_optionst::can_generate_function_body (const irep_idt &name)
10161020{
1017- return false ;
1021+ return true ;
10181022}
10191023
10201024bool jbmc_parse_optionst::generate_function_body (
@@ -1023,7 +1027,27 @@ bool jbmc_parse_optionst::generate_function_body(
10231027 goto_functiont &function,
10241028 bool body_available)
10251029{
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+ }
10271051}
10281052
10291053// / display command line help
0 commit comments