Skip to content

Commit 37afd9a

Browse files
author
svorenova
committed
Store the full method reference of lambda method handles
The method ref can differ from the interface_type and method_type when, e.g., local variables are used in the lambda method.
1 parent 0a49697 commit 37afd9a

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/java_bytecode/java_bytecode_parse_tree.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ class java_bytecode_parse_treet
189189
public:
190190
method_handle_typet handle_type;
191191
irep_idt lambda_method_name;
192+
irep_idt lambda_method_ref;
192193
irep_idt interface_type;
193194
irep_idt method_type;
194195
u2_valuest u2_values;

src/java_bytecode/java_bytecode_parser.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1777,9 +1777,9 @@ java_bytecode_parsert::parse_method_handle(const method_handle_infot &entry)
17771777
const name_and_type_infot &name_and_type =
17781778
ref_entry.get_name_and_type(pool_entry_lambda);
17791779

1780-
const std::string method_name =
1780+
const std::string method_ref =
17811781
class_entry.get_name(pool_entry_lambda) + "." +
1782-
name_and_type.get_name(pool_entry_lambda) +
1782+
name_and_type.get_name(pool_entry_lambda) + ':' +
17831783
name_and_type.get_descriptor(pool_entry_lambda);
17841784

17851785
lambda_method_handlet lambda_method_handle;
@@ -1792,6 +1792,7 @@ java_bytecode_parsert::parse_method_handle(const method_handle_infot &entry)
17921792
// "new" when it is a class variable, instantiated in <init>
17931793
lambda_method_handle.lambda_method_name =
17941794
name_and_type.get_name(pool_entry_lambda);
1795+
lambda_method_handle.lambda_method_ref = method_ref;
17951796
lambda_method_handle.handle_type =
17961797
method_handle_typet::LAMBDA_METHOD_HANDLE;
17971798

0 commit comments

Comments
 (0)