Skip to content

GH-3660: Invoke well-known lambdas explicitly #3883

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 7, 2022

Conversation

artembilan
Copy link
Member

@artembilan artembilan commented Sep 7, 2022

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.

@garyrussell
Copy link
Contributor

garyrussell commented Sep 7, 2022

Your "Fixes" points to the wrong place; should be #3660

(Commit headline too).

Fixes spring-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.
@artembilan artembilan changed the title GH-3879: Invoke well-known lambdas explicitly GH-3660: Invoke well-known lambdas explicitly Sep 7, 2022
@artembilan
Copy link
Member Author

Edited and re-pushed.
Thanks

return this.method.invoke(this.target, args);
}

/* TODO when preview features are available in the next Java version
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might need a NOSONAR (TODO).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's OK: will give us an extra reminder to not forget to fix this eventually 😄

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either way our Sonar instance does not support Java 17 yet: https://stackoverflow.com/questions/71528775/migrate-sonarqube-to-support-java-17

@garyrussell garyrussell merged commit f36181b into spring-projects:main Sep 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Revise LambdaMessageProcessor to call well-known lambdas directly, not via reflection
2 participants