Skip to content

Commit be6f3c9

Browse files
Merge pull request #2346 from peterschrammel/fix-class-models-nondet
Fix allow-null initialization logic for class models
2 parents d17c990 + 7d0195a commit be6f3c9

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

jbmc/src/java_bytecode/java_entry_point.cpp

+7-10
Original file line numberDiff line numberDiff line change
@@ -211,17 +211,14 @@ static void java_static_lifetime_init(
211211
}
212212
else if(sym.value.is_nil() && sym.type!=empty_typet())
213213
{
214-
bool allow_null=!assume_init_pointers_not_null;
215-
if(allow_null)
216-
{
217-
irep_idt nameid=sym.symbol_expr().get_identifier();
218-
if(allow_null && is_java_string_literal_id(nameid))
219-
allow_null=false;
220-
if(allow_null && is_non_null_library_global(nameid))
221-
allow_null = false;
222-
}
214+
const bool is_class_model =
215+
has_suffix(id2string(sym.name), "@class_model");
216+
const bool not_allow_null = is_java_string_literal_id(sym.name) ||
217+
is_non_null_library_global(sym.name) ||
218+
assume_init_pointers_not_null;
219+
223220
object_factory_parameterst parameters = object_factory_parameters;
224-
if(!allow_null)
221+
if(not_allow_null && !is_class_model)
225222
parameters.max_nonnull_tree_depth = 1;
226223

227224
gen_nondet_init(

0 commit comments

Comments
 (0)