RFR 8152893 : StackWalker#getCallerClass is not filtering hidden/ reflection frames when walker is configured to show hidden /reflection frames

Brent Christian brent.christian at oracle.com
Thu Jun 2 23:23:25 UTC 2016


Hi,

The docs for StackWalker.getCallerClass() state, "Reflection frames, 
MethodHandle and hidden frames are filtered regardless of the 
SHOW_REFLECT_FRAMES and SHOW_HIDDEN_FRAMES options."

However getCallerClass() is sensitive to the SHOW_*_FRAMES options, and 
calling getCallerClass() on a StackWalker with those options can return 
classes that should be filtered out, e.g.:
   sun.reflect.NativeMethodAccessorImpl
and
   Test$InnerClass$$Lambda$1/1018937824

StackStreamFactory.CallerClassFinder needs to skip reflection frames 
when consuming frames, a 1-line fix.  I updated the test to cover this 
issue and added a lambda case, and also did some light 
grammar/punctuation improvements on the getCallerClass JavaDoc.

The webrev is here:
   http://cr.openjdk.java.net/~bchristi/8152893/webrev.00/
for your review.

Thanks!
-Brent


More information about the core-libs-dev mailing list