@@ -15,21 +15,25 @@ Date: June 2017
15
15
16
16
#include < goto-programs/goto_functions.h>
17
17
18
+ #include " java_bytecode_convert_class.h"
18
19
#include " java_bytecode_instrument.h"
19
20
#include " java_entry_point.h"
20
21
#include " java_object_factory.h"
21
22
#include " java_root_class.h"
22
23
#include " java_types.h"
24
+ #include " java_utils.h"
23
25
24
- class java_bytecode_instrumentt
26
+ class java_bytecode_instrumentt : public messaget
25
27
{
26
28
public:
27
29
java_bytecode_instrumentt (
28
30
symbol_tablet &_symbol_table,
29
31
const bool _throw_runtime_exceptions,
32
+ message_handlert &_message_handler,
30
33
const size_t _max_array_length):
31
34
symbol_table (_symbol_table),
32
35
throw_runtime_exceptions (_throw_runtime_exceptions),
36
+ message_handler (_message_handler),
33
37
max_array_length (_max_array_length)
34
38
{
35
39
}
@@ -38,8 +42,9 @@ class java_bytecode_instrumentt
38
42
39
43
protected:
40
44
symbol_tablet &symbol_table;
41
- bool throw_runtime_exceptions;
42
- size_t max_array_length;
45
+ const bool throw_runtime_exceptions;
46
+ message_handlert &message_handler;
47
+ const size_t max_array_length;
43
48
44
49
codet throw_exception (
45
50
const exprt &cond,
@@ -92,25 +97,12 @@ codet java_bytecode_instrumentt::throw_exception(
92
97
93
98
if (!symbol_table.has_symbol (exc_obj_name))
94
99
{
95
- // for now, create a class stub
96
- // TODO: model exceptions and use that model
97
- class_typet class_type;
98
- class_type.set_tag (exc_name);
99
- class_type.set (ID_base_name, exc_name);
100
- class_type.set (ID_incomplete_class, true );
101
-
102
- // produce class symbol
103
- symbolt exc_symbol;
104
- exc_symbol.base_name =exc_name;
105
- exc_symbol.pretty_name =exc_name;
106
- exc_symbol.name =" java::" +id2string (exc_name);
107
- class_type.set (ID_name, exc_symbol.name );
108
- exc_symbol.type =class_type;
109
- exc_symbol.mode =ID_java;
110
- exc_symbol.is_type =true ;
111
- symbol_table.add (exc_symbol);
112
- // create the class identifier
113
- java_root_class (exc_symbol);
100
+ generate_class_stub (
101
+ exc_name,
102
+ symbol_table,
103
+ get_message_handler ());
104
+ const symbolt &exc_symbol=symbol_table.lookup (
105
+ " java::" +id2string (exc_name));
114
106
115
107
// create the exception object
116
108
exc=object_factory (
@@ -512,12 +504,14 @@ void java_bytecode_instrumentt::operator()(exprt &expr)
512
504
// / in order to be able to call the object factory to create exceptions.
513
505
void java_bytecode_instrument (
514
506
symbol_tablet &symbol_table,
515
- bool throw_runtime_exceptions,
516
- size_t max_array_length)
507
+ const bool throw_runtime_exceptions,
508
+ message_handlert &message_handler,
509
+ const size_t max_array_length)
517
510
{
518
511
java_bytecode_instrumentt instrument (
519
512
symbol_table,
520
513
throw_runtime_exceptions,
514
+ message_handler,
521
515
max_array_length);
522
516
523
517
Forall_symbols (s_it, symbol_table.symbols )
0 commit comments