You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@geode.apache.org by "Dale Emery (Jira)" <ji...@apache.org> on 2022/03/17 21:27:00 UTC

[jira] [Created] (GEODE-10136) FunctionServiceBase tests fail because lambda classes have no canonical name on JDK 17

Dale Emery created GEODE-10136:
----------------------------------

             Summary: FunctionServiceBase tests fail because lambda classes have no canonical name on JDK 17
                 Key: GEODE-10136
                 URL: https://issues.apache.org/jira/browse/GEODE-10136
             Project: Geode
          Issue Type: Improvement
          Components: functions, tests
    Affects Versions: 1.15.0
            Reporter: Dale Emery


{{FunctionServiceBase}} tests fail on JDK 17.

Here are the relevant factors:
- {{FunctionServiceBase}} uses lambda expressions to create the function objects used to test the function service.
- The objects that represent these lambda expressions use the default implementation of all {{Function}} methods other than {{execute(FunctionContext)}}.
- The default implementation of {{getId()}} returns the canonical name of the function object's class.
- In JDK 17, the class of a lambda expression has no canonical name.
- The product classes {{AbstractExecution}} and {{DistributedRegionFunctionExecutor}} both throw exceptions if the given function reports its ID as {{null}}.

The tests can be fixed by replacing the lambda expressions with uses of a class that returns a non-{{null}} ID.

This may be a product issue. Given that {{Function}} is explicitly annotated as a {{@FunctionalInterface}}:
- It is clearly intended to be used with lambda expressions, yet on JDK 17 it cannot be used with lamda expressions.
- It would be reasonable to expect that an anonymous class that extends `Function` could safely use the default implementation of {{getId()}}, yet anonymous classes have no canonical names on any JDK.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)