Proposed API for JEP 259: Stack-Walking API
mandy.chung at oracle.com
Tue Nov 17 21:57:52 UTC 2015
> On Nov 17, 2015, at 1:13 PM, Peter Levart <peter.levart at gmail.com> wrote:
> But (as described in my other message), Runnable::run is not an entry point. Thread::run is. And Thread::run (a Java method) delegates to Runnable::run. So in this case Thread.class will be returned as a normal caller (which it really is). Are you thinking of detecting this situation and special-casing it?
Thanks for the feedback. I am in the process of clarifying that the javadoc and I see the confusion there. This is the CallerFromMain.java test (some comments need to be cleaned up) but it shows what the getCallerClass is intended to return.
1) call from main - throw UOE
// no caller
2) return Runnable anonymous class
3) return MyRunnable
4) return MyThread::run
5) return CallerFromMain
More information about the core-libs-dev