He-Pin opened a new pull request, #3151: URL: https://github.com/apache/pekko/pull/3151
### Motivation `Reflect.getCallerClass` uses `sun.reflect.Reflection.getCallerClass` via reflection — a JDK 8 internal API that was moved to `jdk.internal.reflect.Reflection` in JDK 9+. On JDK 17+ without `--add-opens` for `jdk.internal.reflect`, this always falls back to `None`, making the `findClassLoader` fallback path dead code. ### Modification Replace with `java.lang.StackWalker` (JDK 9) with `RETAIN_CLASS_REFERENCE` option — the official, supported API for accessing caller class information. The API contract is preserved: given a frame depth index, returns the `Class` at that depth (or `null` if beyond stack). ### Result - Official JDK API instead of internal reflection hack - `StackWalker` was already established in the codebase (`LoggerClass.scala`, `TestKitUtils.scala`) - The `findClassLoader` fallback now works reliably on JDK 17+ ### Tests - `sbt "actor/compile"` — passed ### References Refs #3136 -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
