demery-pivotal commented on pull request #7505: URL: https://github.com/apache/geode/pull/7505#issuecomment-1082189286
> Are there any implications in a mixed version cluster, (members with and without this change) that we deploy/execute functions? That's a great question. I'll answer in three parts. First, these types of implementations give the same ID on JDK 8, 11, and 17: - Non-local concrete (those defined outside a method) - Local classes (those defined within a method) - Anonymous classes - Lambda expressions I believe those cover all of the typical ways users will implement Functions. Second, the [javadoc for Class on JDK 17](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Class.html) says > All kinds of class, including enum classes and record classes, may be hidden classes; all kinds of interface, including annotation interfaces, may be hidden interfaces. This presents the problematic possibility that all three of these conditions could be true: - The function uses the default `getId()` declared in the `Function` interface. - The function's class is a kind that has a canonical name on JDK 8 and 11, but no canonical name on JDK 17. - Its `getName()` on JDK 17 returns a value different from its `getCanonicalName()` on JDK 8 and 11. In that case, the function will have a different ID on JDK 17 than on an earlier JDK. I do not know under what conditions a class that was non-hidden on earlier JDKs is hidden on JDK 17. Third, the problem is worse without this PR. Without this PR, the default `getId()` always returns the class's canonical name. This matters because: - The class of a `Function` defined as a lambda expression has a meaningful canonical name before JDK 17, but a `null` canonical on JDK 17. Without this PR, lambda functions will always have different IDs on JDK 17 than on earlier JDKs. - The class of a `Function` defined as an anonymous class has a `null` canonical name on all JDKs. Without this PR, anonymous `Functions` will always have a `null` ID on all JDKs. We will (separately) improve the Geode documentation of to more strongly recommend overriding `getId()` to return a reliable identifier, and to stress the importance of verifying that each `Function` implementation (whether it uses the default `getId()` or a custom one) yields the same ID on all JDKs. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
