Skip to content

Commit 5ec200c

Browse files
committed
Add support for lambdas with implicit boxing
Turns out the usual lambda metafactory can apply boxing/unboxing, so you might see a situation like int myMethod(int i) { ... } interface MyLambdaType { Integer f(Integer i); } MyLambdaType mlt = SomeType::myMethod; And contrary to my prior expectations, the compiler doesn't generate a method stub to do the type conversion, it just directly requests an invokestatic lambda pointed at myMethod, regardless of the int vs. Integer clash. The lambda metafactory (which re-implement in JBMC) is then responsible for adding the necessary conversions.
1 parent d58ebd8 commit 5ec200c

29 files changed

+445
-6
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CORE
2+
BoxingLambda
3+
--function BoxingLambda.testBoolean --cp `../../../../scripts/format_classpath.sh . ../../../lib/java-models-library/target/core-models.jar`
4+
\[java::BoxingLambda\.testBoolean:\(\)V\.assertion\.1\] line 73 assertion at file BoxingLambda\.java line 73 function java::BoxingLambda\.testBoolean:\(\)V bytecode-index 25: SUCCESS
5+
\[java::BoxingLambda\.testBoolean:\(\)V\.assertion\.2\] line 74 assertion at file BoxingLambda\.java line 74 function java::BoxingLambda\.testBoolean:\(\)V bytecode-index 35: SUCCESS
6+
\[java::BoxingLambda\.testBoolean:\(\)V\.assertion\.3\] line 75 assertion at file BoxingLambda\.java line 75 function java::BoxingLambda\.testBoolean:\(\)V bytecode-index 47: SUCCESS
7+
\[java::BoxingLambda\.testBoolean:\(\)V\.assertion\.4\] line 76 assertion at file BoxingLambda\.java line 76 function java::BoxingLambda\.testBoolean:\(\)V bytecode-index 53: FAILURE
8+
^EXIT=10$
9+
^SIGNAL=0$
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)