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)

Reply via email to