Skip to content

Commit 39807f8

Browse files
tautschnigDaniel Kroening
authored and
Daniel Kroening
committed
Use constructor instead of setting individual fields
Required members may change.
1 parent 8eb9525 commit 39807f8

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

src/java_bytecode/java_bytecode_convert_class.cpp

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -261,14 +261,18 @@ void java_bytecode_convert_classt::add_array_types()
261261
// we have the base class, java.lang.Object, length and data
262262
// of appropriate type
263263
struct_type.set_tag(symbol_type.get_identifier());
264-
struct_type.components().resize(3);
265-
struct_type.components()[0].set_name("@java.lang.Object");
266-
struct_type.components()[0].type()=symbol_typet("java::java.lang.Object");
267-
struct_type.components()[1].set_name("length");
268-
struct_type.components()[1].type()=java_int_type();
269-
struct_type.components()[2].set_name("data");
270-
struct_type.components()[2].type()=
271-
pointer_typet(java_type_from_char(letters[i]));
264+
265+
struct_type.components().reserve(3);
266+
struct_typet::componentt
267+
comp0("@java.lang.Object", symbol_typet("java::java.lang.Object"));
268+
struct_type.components().push_back(comp0);
269+
270+
struct_typet::componentt comp1("length", java_int_type());
271+
struct_type.components().push_back(comp1);
272+
273+
struct_typet::componentt
274+
comp2("data", pointer_typet(java_type_from_char(l)));
275+
struct_type.components().push_back(comp2);
272276

273277
symbolt symbol;
274278
symbol.name=symbol_type.get_identifier();

0 commit comments

Comments
 (0)