Skip to content

Commit c5c4c7b

Browse files
committed
Avoid default constructing code_ifthenelset
The default constructor is deprecated.
1 parent ab81ffc commit c5c4c7b

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

jbmc/src/java_bytecode/java_bytecode_instrument.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -229,14 +229,15 @@ code_ifthenelset java_bytecode_instrumentt::check_class_cast(
229229
if(null_check_op.type()!=voidptr)
230230
null_check_op.make_typecast(voidptr);
231231

232-
codet check_code;
233232
if(throw_runtime_exceptions)
234233
{
235-
check_code=
234+
return code_ifthenelset(
235+
notequal_exprt(
236+
std::move(null_check_op), null_pointer_exprt(std::move(voidptr))),
236237
throw_exception(
237238
not_exprt(class_cast_check),
238239
original_loc,
239-
"java.lang.ClassCastException");
240+
"java.lang.ClassCastException"));
240241
}
241242
else
242243
{
@@ -246,12 +247,11 @@ code_ifthenelset java_bytecode_instrumentt::check_class_cast(
246247

247248
codet assert_class = create_fatal_assertion(class_cast_check, check_loc);
248249

249-
check_code=std::move(assert_class);
250+
return code_ifthenelset(
251+
notequal_exprt(
252+
std::move(null_check_op), null_pointer_exprt(std::move(voidptr))),
253+
std::move(assert_class));
250254
}
251-
252-
return code_ifthenelset(
253-
notequal_exprt(std::move(null_check_op), null_pointer_exprt(voidptr)),
254-
std::move(check_code));
255255
}
256256

257257
/// Checks whether \p expr is null and throws NullPointerException/

0 commit comments

Comments
 (0)