Proposed API for JEP 259: Stack-Walking API

Mandy Chung mandy.chung at oracle.com
Tue Nov 10 02:20:01 UTC 2015


I have updated the APIs to incorporate all the feedback.  Thank you all.  Let me know if I miss any.  

Summary:
1. Change to use wildcard walk(Function<? super Stream<StackFrame>, ? extends T> function) 
2. Removed the walk method taking IntUnaryOperator batchSizeMapper argument
3. Add the new static factory method to create StackWalker and keep the constructors private
4. StackFrame::getFileName and StackFrame::getLineNumber return Optional<String>, OptionaIInt respectively as they are optional. 
4. maxDepth is not really needed as the user can use Stream::limit.  So taken out.
5. Add StackWalker::create(Set<Option> options, int estimateDepth) to take an estimate depth to give a hint the estimated number of frames to traverse by this walker.  The implementation may use it to tune the buffer size.

Javadoc
   http://cr.openjdk.java.net/~mchung/jdk9/jep259/api/java/lang/StackWalker.html

FYI.  I’ll post the webrevs in a new code review thread.
Mandy


More information about the core-libs-dev mailing list