Skip to content

Set declaring_class for string solver implemented methods #4478

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions jbmc/src/java_bytecode/java_bytecode_convert_method.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,7 @@ void java_bytecode_convert_method_lazy(
// Not used in jbmc at present, but other codebases that use jbmc as a library
// use this information.
method_symbol.type.set(ID_C_abstract, m.is_abstract);
set_declaring_class(method_symbol, class_symbol.name);

if(java_bytecode_parse_treet::find_annotation(
m.annotations, "java::org.cprover.MustNotThrow"))
Expand Down
7 changes: 7 additions & 0 deletions jbmc/src/java_bytecode/java_bytecode_language.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1037,6 +1037,7 @@ bool java_bytecode_languaget::convert_single_method(
// Nothing to do if body is already loaded
if(symbol.value.is_not_nil())
return false;
INVARIANT(declaring_class(symbol), "Method must have a declaring class.");

// Get bytecode for specified function if we have it
method_bytecodet::opt_reft cmb = method_bytecode.get(function_id);
Expand All @@ -1060,6 +1061,8 @@ bool java_bytecode_languaget::convert_single_method(
// Add these to the needed_lazy_methods collection
notify_static_method_calls(generated_code, needed_lazy_methods);
writable_symbol.value = std::move(generated_code);
INVARIANT(
declaring_class(writable_symbol), "Method must have a declaring class.");
return false;
}
else if(
Expand Down Expand Up @@ -1103,6 +1106,8 @@ bool java_bytecode_languaget::convert_single_method(
// function:
notify_static_method_calls(
to_code(writable_symbol.value), needed_lazy_methods);
INVARIANT(
declaring_class(writable_symbol), "Method must have a declaring class.");
return false;
}

Expand All @@ -1121,6 +1126,7 @@ bool java_bytecode_languaget::convert_single_method(
string_preprocess,
class_hierarchy,
threading_support);
INVARIANT(declaring_class(symbol), "Method must have a declaring class.");
return false;
}

Expand All @@ -1144,6 +1150,7 @@ bool java_bytecode_languaget::convert_single_method(
needed_lazy_methods->add_all_needed_classes(*pointer_return_type);
}

INVARIANT(declaring_class(symbol), "Method must have a declaring class.");
return true;
}

Expand Down