Proposed API for JEP 259: Stack-Walking API
Jeroen Frijters
jeroen at sumatra.nl
Sun Nov 1 06:05:29 UTC 2015
Hi Mandy,
I like the API shape and this capability is very much needed. Thanks!
It does bring something related to mind and that is that the current Java ecosystem is already very dependent on accurate stack frames (i.e. not removing them when inlining) and with this API this will probably only become worse. So it might be worth considering making this a hard spec requirement.
Regards,
Jeroen
> -----Original Message-----
> From: core-libs-dev [mailto:core-libs-dev-bounces at openjdk.java.net] On
> Behalf Of Mandy Chung
> Sent: Friday, October 30, 2015 20:05
> To: core-libs-dev <core-libs-dev at openjdk.java.net>
> Subject: Proposed API for JEP 259: Stack-Walking API
>
> 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/
>
>
>
>
>
>
More information about the core-libs-dev
mailing list