Skip to content

Commit 0a99dc8

Browse files
author
thk123
committed
Added invariants on the correct structure of the array type
Added to converting types and when creating non det initilization.
1 parent 37106b6 commit 0a99dc8

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/java_bytecode/java_bytecode_convert_class.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,11 @@ void java_bytecode_convert_classt::add_array_types(symbol_tablet &symbol_table)
292292
comp2.set_base_name("data");
293293
struct_type.components().push_back(comp2);
294294

295+
INVARIANT(
296+
is_valid_java_array(struct_type),
297+
"Constructed a new type representing a Java Array "
298+
"object that doesn't match expectations");
299+
295300
symbolt symbol;
296301
symbol.name=symbol_type.get_identifier();
297302
symbol.base_name=symbol_type.get(ID_C_base_name);

src/java_bytecode/java_object_factory.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,6 +1059,10 @@ void java_object_factoryt::gen_nondet_array_init(
10591059
// Otherwise we're updating the array in place, and use the
10601060
// existing array allocation and length.
10611061

1062+
INVARIANT(
1063+
is_valid_java_array(struct_type),
1064+
"Java struct array does not conform to expectations");
1065+
10621066
dereference_exprt deref_expr(expr, expr.type().subtype());
10631067
const auto &comps=struct_type.components();
10641068
exprt length_expr=member_exprt(deref_expr, "length", comps[1].type());

0 commit comments

Comments
 (0)