Skip to content
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

Support primitive function interfaces #1098

Open
br05s opened this issue Dec 25, 2023 · 1 comment
Open

Support primitive function interfaces #1098

br05s opened this issue Dec 25, 2023 · 1 comment

Comments

@br05s
Copy link

br05s commented Dec 25, 2023

When implementing some functions for Spring Cloud Stream, I noticed that it only supports functions that extend from Consumer, Supplier, and Function. Java 8 functions also has support for primitives with the use of interfaces such as IntConsumer, IntSupplier, IntFunction, and ToIntFunction. There are also long and double versions of each.

org.springframework.cloud.function.context.catalog.FunctionTypeUtils has a check in assertSupportedTypes that doesn't check for these other types.

I'd like to see these other interfaces supported so primitive types can be used without the need for boxing/unboxing. I've considered using boxed types, but do not like that approach due to performance impacts.

@olegz olegz added the feature label Mar 27, 2024
@olegz
Copy link
Contributor

olegz commented Mar 27, 2024

The level of complexity it would introduce to the current code base would probably be a bit disproportionate to the end benefit. However I did not have a proper chance to investigate it nor has it ever been requested.
In other words it would definitely be of lowest priority. That said if you want to take a shot at it, i would gladly review the PR, so let me know.

@olegz olegz changed the title Support primative function interfaces Support primitive function interfaces Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants