Proposed API for JEP 259: Stack-Walking API (original) (raw)
Mandy Chung mandy.chung at oracle.com
Fri Oct 30 19:04:33 UTC 2015
- Previous message: RFR (M) 8140802 - Clean up and refactor of class loading code for CDS
- Next message: Proposed API for JEP 259: Stack-Walking API
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
JEP 259: http://openjdk.java.net/jeps/259
Javadoc for the proposed StackWalker API: http://cr.openjdk.java.net/~mchung/jdk9/jep259/api/java/lang/StackWalker.html
A simple way to walk the stack:
StackWalker walker = new StackWalker(StackWalker.Option.CLASS_REFERENCE); walker.walk((s) -> s.filter(f -> interestingClasses.contains(f.getDeclaringClass())).findFirst());
The current usage of sun.reflect.Reflection.getCallerClass(int depth) can be replaced with this StackWalker API.
Any feedback on the proposed API is appreciated.
Mandy
P.S. webrev of the current implementation: http://cr.openjdk.java.net/~mchung/jdk9/jep259/webrev.00/
- Previous message: RFR (M) 8140802 - Clean up and refactor of class loading code for CDS
- Next message: Proposed API for JEP 259: Stack-Walking API
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]