> On Nov 15, 2015, at 10:59 AM, Peter Levart <peter.lev...@gmail.com> wrote: > > OTOH in the described cases, a caller of walker.getCallerClass() is actually > expecting to be called by a Java method, right? So what would it be if such > "caller-sensitive" method demanded to be called by a Java method and throw > IllegalArgumentException("Not called by Java method") otherwise? > > Have you thought of that possibility?
Are you thinking about a JNI method calling getCallerClass? Or refer getCallerClass being the bottom of the stack? I don’t see any issue for a JNI method calling getCallerClass and it’s doing: * Class<?> caller = walker.walk(s -> * s.map(StackFrame::getDeclaringClass) * .skip(2) * .findFirst()); Mandy