Skip to content

Commit 9940a41

Browse files
Update class type before assigning to class_symbol.type
1 parent 34ff0bc commit 9940a41

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

jbmc/src/java_bytecode/java_bytecode_convert_class.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1142,6 +1142,7 @@ void mark_java_implicitly_generic_class_type(
11421142
{
11431143
const std::string qualified_class_name = "java::" + id2string(class_name);
11441144
PRECONDITION(symbol_table.has_symbol(qualified_class_name));
1145+
// This will have its type changed
11451146
symbolt &class_symbol = symbol_table.get_writeable_ref(qualified_class_name);
11461147
const java_class_typet &class_type = to_java_class_type(class_symbol.type);
11471148

@@ -1197,19 +1198,21 @@ void mark_java_implicitly_generic_class_type(
11971198
// implicitly generic and update identifiers of type parameters used in fields
11981199
if(!implicit_generic_type_parameters.empty())
11991200
{
1200-
class_symbol.type = java_implicitly_generic_class_typet(
1201+
java_implicitly_generic_class_typet new_class_type(
12011202
class_type, implicit_generic_type_parameters);
12021203

1203-
for(auto &field : class_type.components())
1204+
for(auto &field : new_class_type.components())
12041205
{
12051206
find_and_replace_parameters(
12061207
field.type(), implicit_generic_type_parameters);
12071208
}
12081209

1209-
for(auto &base : class_type.bases())
1210+
for(auto &base : new_class_type.bases())
12101211
{
12111212
find_and_replace_parameters(
12121213
base.type(), implicit_generic_type_parameters);
12131214
}
1215+
1216+
class_symbol.type = new_class_type;
12141217
}
12151218
}

0 commit comments

Comments
 (0)