Skip to content

Support primitive function interfaces #1098

Closed

Description

@br05s

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.

Activity

  1. olegz commented on Mar 27, 2024

    @olegz
    Contributor

    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.

  2. changed the title [-]Support primative function interfaces[/-] [+]Support primitive function interfaces[/+] on Mar 27, 2024
  3. github-actions commented on Oct 24, 2024

    @github-actions

    This issue has been stale for over 60 days

  4. JunggiKim commented on Oct 26, 2024

    @JunggiKim
    Contributor

    Hello I would like to participate in this contribution is that ok?

  5. added a commit that references this issue on Oct 31, 2024
  6. added this to the 4.2 milestone on Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions