paulk-asert opened a new pull request, #2697:
URL: https://github.com/apache/groovy/pull/2697
… a reference type
A @CompileStatic lambda declaring a primitive parameter (e.g. (int a) ->
...) against a generic functional interface (e.g. Function<Integer,Integer>)
compiled cleanly but threw at runtime:
java.lang.invoke.LambdaConversionException:
int is not a subtype of class java.lang.Object
AbstractFunctionalInterfaceWriter.convertParameterType always emitted a
primitive implementation-method parameter when the lambda declared a primitive,
ignoring the target (functional-interface) parameter type. But
LambdaMetafactory links against the erased SAM signature (Object) and will not
unbox to a primitive, so the implementation method must accept the boxed type
when the SAM parameter is a reference type. It stays primitive only when the
SAM parameter is itself primitive (e.g. IntUnaryOperator), preserving
GROOVY-9790.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]