Skip to content

Commit 9b85315

Browse files
Merge pull request #4478 from thomasspriggs/tas/declarator_of_solver_methods
Set declaring_class for string solver implemented methods
2 parents 8235cb4 + 4bc0680 commit 9b85315

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

jbmc/src/java_bytecode/java_bytecode_convert_method.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,7 @@ void java_bytecode_convert_method_lazy(
388388
// Not used in jbmc at present, but other codebases that use jbmc as a library
389389
// use this information.
390390
method_symbol.type.set(ID_C_abstract, m.is_abstract);
391+
set_declaring_class(method_symbol, class_symbol.name);
391392

392393
if(java_bytecode_parse_treet::find_annotation(
393394
m.annotations, "java::org.cprover.MustNotThrow"))

jbmc/src/java_bytecode/java_bytecode_language.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,6 +1037,7 @@ bool java_bytecode_languaget::convert_single_method(
10371037
// Nothing to do if body is already loaded
10381038
if(symbol.value.is_not_nil())
10391039
return false;
1040+
INVARIANT(declaring_class(symbol), "Method must have a declaring class.");
10401041

10411042
// Get bytecode for specified function if we have it
10421043
method_bytecodet::opt_reft cmb = method_bytecode.get(function_id);
@@ -1060,6 +1061,8 @@ bool java_bytecode_languaget::convert_single_method(
10601061
// Add these to the needed_lazy_methods collection
10611062
notify_static_method_calls(generated_code, needed_lazy_methods);
10621063
writable_symbol.value = std::move(generated_code);
1064+
INVARIANT(
1065+
declaring_class(writable_symbol), "Method must have a declaring class.");
10631066
return false;
10641067
}
10651068
else if(
@@ -1103,6 +1106,8 @@ bool java_bytecode_languaget::convert_single_method(
11031106
// function:
11041107
notify_static_method_calls(
11051108
to_code(writable_symbol.value), needed_lazy_methods);
1109+
INVARIANT(
1110+
declaring_class(writable_symbol), "Method must have a declaring class.");
11061111
return false;
11071112
}
11081113

@@ -1121,6 +1126,7 @@ bool java_bytecode_languaget::convert_single_method(
11211126
string_preprocess,
11221127
class_hierarchy,
11231128
threading_support);
1129+
INVARIANT(declaring_class(symbol), "Method must have a declaring class.");
11241130
return false;
11251131
}
11261132

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

1153+
INVARIANT(declaring_class(symbol), "Method must have a declaring class.");
11471154
return true;
11481155
}
11491156

0 commit comments

Comments
 (0)