@@ -66,8 +66,7 @@ class java_bytecode_instrumentt:public messaget
66
66
67
67
codet check_null_dereference (
68
68
const exprt &expr,
69
- const source_locationt &original_loc,
70
- const bool assertion_enabled);
69
+ const source_locationt &original_loc);
71
70
72
71
codet check_class_cast (
73
72
const exprt &class1,
@@ -271,8 +270,7 @@ codet java_bytecode_instrumentt::check_class_cast(
271
270
// / assertion checking the subtype relation
272
271
codet java_bytecode_instrumentt::check_null_dereference (
273
272
const exprt &expr,
274
- const source_locationt &original_loc,
275
- const bool assertion_enabled)
273
+ const source_locationt &original_loc)
276
274
{
277
275
const equal_exprt equal_expr (
278
276
expr,
@@ -283,17 +281,12 @@ codet java_bytecode_instrumentt::check_null_dereference(
283
281
equal_expr,
284
282
original_loc, " java.lang.NullPointerException" );
285
283
286
- if (assertion_enabled)
287
- {
288
- code_assertt check ((not_exprt (equal_expr)));
289
- check.add_source_location ()
290
- .set_comment (" Throw null" );
291
- check.add_source_location ()
292
- .set_property_class (" null-pointer-exception" );
293
- return check;
294
- }
295
-
296
- return code_skipt ();
284
+ code_assertt check ((not_exprt (equal_expr)));
285
+ check.add_source_location ()
286
+ .set_comment (" Throw null" );
287
+ check.add_source_location ()
288
+ .set_property_class (" null-pointer-exception" );
289
+ return check;
297
290
}
298
291
299
292
// / Checks whether `length`>=0 and throws NegativeArraySizeException/
@@ -462,8 +455,7 @@ void java_bytecode_instrumentt::instrument_code(exprt &expr)
462
455
block.copy_to_operands (
463
456
check_null_dereference (
464
457
code_function_call.arguments ()[0 ],
465
- code_function_call.source_location (),
466
- true ));
458
+ code_function_call.source_location ()));
467
459
}
468
460
469
461
for (const auto &arg : code_function_call.arguments ())
@@ -528,8 +520,7 @@ codet java_bytecode_instrumentt::instrument_expr(
528
520
result.copy_to_operands (
529
521
check_null_dereference (
530
522
expr.op0 (),
531
- expr.source_location (),
532
- true ));
523
+ expr.source_location ()));
533
524
}
534
525
else if (statement==ID_java_new_array)
535
526
{
@@ -558,8 +549,7 @@ codet java_bytecode_instrumentt::instrument_expr(
558
549
codet null_dereference_check=
559
550
check_null_dereference (
560
551
dereference_expr.op0 (),
561
- dereference_expr.source_location (),
562
- false );
552
+ dereference_expr.source_location ());
563
553
result.move_to_operands (null_dereference_check);
564
554
}
565
555
0 commit comments