@@ -278,3 +278,62 @@ SCENARIO(
278
278
}
279
279
});
280
280
}
281
+
282
+ void validate_member_variable_lambda_assignment (
283
+ const symbol_tablet &symbol_table,
284
+ const std::vector<codet> &instructions,
285
+ const lambda_assignment_test_datat &test_data,
286
+ const std::string lambda_variable_id)
287
+ {
288
+ const auto lambda_assignment =
289
+ require_goto_statements::find_this_component_assignment (
290
+ instructions, lambda_variable_id);
291
+
292
+ REQUIRE (lambda_assignment.non_null_assignments .size () == 1 );
293
+ REQUIRE_FALSE (lambda_assignment.null_assignment .has_value ());
294
+
295
+ validate_lamdba_assignement (
296
+ symbol_table, instructions, test_data, lambda_assignment);
297
+ }
298
+
299
+ SCENARIO (
300
+ " Converting invokedynamic with a member lambda" ,
301
+ " [core]"
302
+ " [lamdba][java_bytecode][java_bytecode_convert_method][!mayfail]" )
303
+ {
304
+ // NOLINTNEXTLINE(whitespace/braces)
305
+ run_test_with_compilers ([](const std::string &compiler) {
306
+ GIVEN (
307
+ " A class with a static lambda variables from " + compiler + " compiler." )
308
+ {
309
+ symbol_tablet symbol_table = load_java_class (
310
+ " MemberLambdas" ,
311
+ " ./java_bytecode/java_bytecode_parser/lambda_examples/" + compiler +
312
+ " _classes/" ,
313
+ " MemberLambdas.<init>" );
314
+
315
+ WHEN (" Inspecting the assignments of the entry function" )
316
+ {
317
+ const std::vector<codet> &instructions =
318
+ require_goto_statements::get_all_statements (
319
+ symbol_table.lookup_ref (" java::MemberLambdas.<init>:()V" ).value );
320
+
321
+ const std::string function_prefix_regex_str = " java::MemberLambdas" ;
322
+
323
+ THEN (
324
+ " The local variable should be assigned a temp object implementing "
325
+ " SimpleLambda" )
326
+ {
327
+ lambda_assignment_test_datat test_data;
328
+ test_data.lambda_interface = " java::SimpleLambda" ;
329
+ test_data.lambda_interface_method_descriptor = " .Execute:()V" ;
330
+ test_data.lambda_function_id = " java::MemberLambdas.lambda$new$0:()V" ;
331
+ test_data.expected_params = {};
332
+ test_data.should_return_value = false ;
333
+ validate_member_variable_lambda_assignment (
334
+ symbol_table, instructions, test_data, " simpleLambda" );
335
+ }
336
+ }
337
+ }
338
+ });
339
+ }
0 commit comments