You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now it does ReflectionUtils.makeAccessible(this.method); and then Object result = this.method.invoke(this.target, args);, but probably we can call Function.apply(), GenericHandler.handle(), GenericSelector.accept(), etc. directly since we know the places LambdaMessageProcessor is used, plus we can infer the type of the lambda and delegate to respective strategy.
NOTE: With Java 17 we have to add --add-opens java.base/java.util.function=ALL-UNNAMED when Function lambda is in use.
Not having method.setAccessible(true) in this case does not help: it still fail on method.invoke() because cannot get access to the method even if it is public by definition of lambda itself.
The text was updated successfully, but these errors were encountered:
Fixesspring-projects#3660
* Change the `LambdaMessageProcessor` to invoke `Function`, `GenericHandler`,
`GenericSelector` & `GenericTransformer` explicitly without reflection.
This allows to avoid `--add-opens` for Java types to be used from reflections.
Plus this removes some overhead with native images.
And in general it is faster than reflection invocation.
Fixes#3660
* Change the `LambdaMessageProcessor` to invoke `Function`, `GenericHandler`,
`GenericSelector` & `GenericTransformer` explicitly without reflection.
This allows to avoid `--add-opens` for Java types to be used from reflections.
Plus this removes some overhead with native images.
And in general it is faster than reflection invocation.
Right now it does
ReflectionUtils.makeAccessible(this.method);
and thenObject result = this.method.invoke(this.target, args);
, but probably we can callFunction.apply()
,GenericHandler.handle()
,GenericSelector.accept()
, etc. directly since we know the placesLambdaMessageProcessor
is used, plus we can infer the type of the lambda and delegate to respective strategy.NOTE: With Java 17 we have to add
--add-opens java.base/java.util.function=ALL-UNNAMED
whenFunction
lambda is in use.Not having
method.setAccessible(true)
in this case does not help: it still fail onmethod.invoke()
because cannot get access to the method even if it ispublic
by definition of lambda itself.The text was updated successfully, but these errors were encountered: