Review request 8153912: StackFrame::getFileName and StackFrame::getLineNumber not needed
mandy.chung at oracle.com
Mon Mar 13 22:38:31 UTC 2017
I have filed https://bugs.openjdk.java.net/browse/JDK-8176593 for Throwable::getStackTrace performance regression.
> On Mar 13, 2017, at 1:57 PM, Daniel Fuchs <daniel.fuchs at oracle.com> wrote:
> Hi Ralph,
> On 13/03/17 19:06, Ralph Goers wrote:
>> OK - I will do that when I fix the other bug. But if you can suggest some other way to bail out of the loop after I have found the correct StackFrame that would help as well.
> I'd suggest using filter + findFirst, possibly with a
> statefull Predicate<StackFrame> - depending on the logic
> needed to identify the frame you want to return.
> That's what we do in java.util.logging - where we walk
> until we find a logger implementation frame, and then
> continue walking until we find a frame that no longer
> belong to the logging infrastructure.
As Daniel said, we suggest to walk the stack from the most recent frame and stops when the logging implementation frames are skipped.
This is where java.util.logging does its filtering that you can reference:
More information about the core-libs-dev