Skip to content

Commit a29ca48

Browse files
author
svorenova
committed
Add lambda method handles during class conversion
1 parent 7ff2de7 commit a29ca48

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
@@ -306,6 +306,18 @@ void java_bytecode_convert_classt::convert(const classt &c)
306306
}
307307
}
308308

309+
// now do lambda method handles (bootstrap methods)
310+
for(const auto &lambda_entry : c.lambda_method_handle_map)
311+
{
312+
// if the handle is of unknown type, we still need to store it to preserve
313+
// the correct indexing (invokedynamic instructions will retrieve
314+
// method handles according by index)
315+
lambda_entry.second.is_unknown_handle()
316+
? class_type.add_unknown_lambda_method_handle()
317+
: class_type.add_lambda_method_handle(
318+
"java::" + id2string(lambda_entry.second.lambda_method_ref));
319+
}
320+
309321
// produce class symbol
310322
symbolt new_symbol;
311323
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
@@ -204,6 +204,11 @@ class java_bytecode_parse_treet
204204
lambda_method_handle.u2_values = std::move(params);
205205
return lambda_method_handle;
206206
}
207+
208+
bool is_unknown_handle() const
209+
{
210+
return handle_type == method_handle_typet::UNKNOWN_HANDLE;
211+
}
207212
};
208213

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

0 commit comments

Comments
 (0)