He-Pin commented on code in PR #2106:
URL: https://github.com/apache/pekko/pull/2106#discussion_r2311779996


##########
actor/src/main/java/org/apache/pekko/util/ClassContext.java:
##########
@@ -0,0 +1,18 @@
+package org.apache.pekko.util;
+
+import java.util.function.Function;
+import java.util.stream.Stream;
+
+public final class ClassContext {
+  private ClassContext() {
+    throw new UnsupportedOperationException("Cannot instantiate utility 
class");
+  }
+
+  private static final Function<Stream<StackWalker.StackFrame>, Class<?>[]> 
CLASS_STACK_WALKER =
+      frames -> 
frames.map(StackWalker.StackFrame::getDeclaringClass).toArray(Class<?>[]::new);
+
+  public static Class<?>[] getClassStack() {
+    return StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE)
+        .walk(CLASS_STACK_WALKER);
+  }

Review Comment:
   much easier to write it in Java, I have a problem when supporting Scala 2.12



-- 
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: notifications-unsubscr...@pekko.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@pekko.apache.org
For additional commands, e-mail: notifications-h...@pekko.apache.org

Reply via email to