@@ -75,11 +75,6 @@ class java_bytecode_convert_classt:public messaget
75
75
lazy_methods_modet lazy_methods_mode;
76
76
java_string_library_preprocesst &string_preprocess;
77
77
78
- // / This field will be initialized to false, and set to true when
79
- // / add_array_types() is executed. It serves as a sentinel to make sure that
80
- // / the code using this class calls add_array_types() at least once.
81
- static bool add_array_types_executed;
82
-
83
78
// conversion
84
79
void convert (const classt &c);
85
80
void convert (symbolt &class_symbol, const fieldt &f);
@@ -88,9 +83,6 @@ class java_bytecode_convert_classt:public messaget
88
83
static void add_array_types (symbol_tablet &symbol_table);
89
84
};
90
85
91
- // initialization of static field
92
- bool java_bytecode_convert_classt::add_array_types_executed=false ;
93
-
94
86
void java_bytecode_convert_classt::convert (const classt &c)
95
87
{
96
88
std::string qualified_classname=" java::" +id2string (c.name );
@@ -256,23 +248,21 @@ void java_bytecode_convert_classt::convert(
256
248
// / java::array[X] where X is byte, float, int, char...
257
249
void java_bytecode_convert_classt::add_array_types (symbol_tablet &symbol_table)
258
250
{
259
- // this method only adds stuff to the symbol table, no need to execute it more
260
- // than once
261
- if (add_array_types_executed)
262
- return ;
263
- add_array_types_executed=true ;
264
-
265
251
const std::string letters=" ijsbcfdza" ;
266
252
267
253
for (const char l : letters)
268
254
{
269
255
symbol_typet symbol_type=
270
256
to_symbol_type (java_array_type (l).subtype ());
271
257
258
+ const irep_idt &symbol_type_identifier=symbol_type.get_identifier ();
259
+ if (symbol_table.has_symbol (symbol_type_identifier))
260
+ return ;
261
+
272
262
struct_typet struct_type;
273
263
// we have the base class, java.lang.Object, length and data
274
264
// of appropriate type
275
- struct_type.set_tag (symbol_type. get_identifier () );
265
+ struct_type.set_tag (symbol_type_identifier );
276
266
277
267
struct_type.components ().reserve (3 );
278
268
struct_typet::componentt
@@ -298,7 +288,7 @@ void java_bytecode_convert_classt::add_array_types(symbol_tablet &symbol_table)
298
288
" object that doesn't match expectations" );
299
289
300
290
symbolt symbol;
301
- symbol.name =symbol_type. get_identifier () ;
291
+ symbol.name =symbol_type_identifier ;
302
292
symbol.base_name =symbol_type.get (ID_C_base_name);
303
293
symbol.is_type =true ;
304
294
symbol.type =struct_type;
@@ -308,7 +298,7 @@ void java_bytecode_convert_classt::add_array_types(symbol_tablet &symbol_table)
308
298
// ----------------------------
309
299
310
300
const irep_idt clone_name=
311
- id2string (symbol_type. get_identifier () )+" .clone:()Ljava/lang/Object;" ;
301
+ id2string (symbol_type_identifier )+" .clone:()Ljava/lang/Object;" ;
312
302
code_typet clone_type;
313
303
clone_type.return_type ()=
314
304
java_reference_type (symbol_typet (" java::java.lang.Object" ));
@@ -413,7 +403,7 @@ void java_bytecode_convert_classt::add_array_types(symbol_tablet &symbol_table)
413
403
symbolt clone_symbol;
414
404
clone_symbol.name =clone_name;
415
405
clone_symbol.pretty_name =
416
- id2string (symbol_type. get_identifier () )+" .clone:()" ;
406
+ id2string (symbol_type_identifier )+" .clone:()" ;
417
407
clone_symbol.base_name =" clone" ;
418
408
clone_symbol.type =clone_type;
419
409
clone_symbol.value =clone_body;
0 commit comments