Skip to content

Commit bf04c93

Browse files
author
svorenova
committed
Add lambda method handles during class conversion
1 parent a518393 commit bf04c93

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/java_bytecode/java_bytecode_convert_class.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,18 @@ void java_bytecode_convert_classt::convert(const classt &c)
310310
}
311311
}
312312

313+
// now do lambda method handles (bootstrap methods)
314+
for(const auto &lambda_entry : c.lambda_method_handle_map)
315+
{
316+
// if the handle is of unknown type, we still need to store it to preserve
317+
// the correct indexing (invokedynamic instructions will retrieve
318+
// method handles by index)
319+
lambda_entry.second.is_unknown_handle()
320+
? class_type.add_unknown_lambda_method_handle()
321+
: class_type.add_lambda_method_handle(
322+
"java::" + id2string(lambda_entry.second.lambda_method_ref));
323+
}
324+
313325
// produce class symbol
314326
symbolt new_symbol;
315327
new_symbol.base_name=c.name;

src/java_bytecode/java_bytecode_parse_tree.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,11 @@ class java_bytecode_parse_treet
205205
lambda_method_handle.u2_values = std::move(params);
206206
return lambda_method_handle;
207207
}
208+
209+
bool is_unknown_handle() const
210+
{
211+
return handle_type == method_handle_typet::UNKNOWN_HANDLE;
212+
}
208213
};
209214

210215
// TODO(tkiley): This map shouldn't be interacted with directly (instead

0 commit comments

Comments
 (0)