I considered Optional<Class<?>>. I believe it is rare to have a JNI attached 
thread calling StackWalker::getCallerClass from native.  Most common cases will find a 
caller class.   Returning an Optional will force most common uses to handle the case if 
it’s absent.  It’s a tradeoff that I think it’s better to return Thread.class for the JNI 
attached thread calling getCallerClass in native which would rarely happen.

+1 on returning Thread.class in these cases.  Its a pragmatic compromise.

Reply via email to