You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by Ralph Goers <ra...@dslextreme.com> on 2015/11/02 20:57:21 UTC
Fwd: Proposed API for JEP 259: Stack-Walking API
FYI
Ralph
> Begin forwarded message:
>
> From: Mandy Chung <ma...@oracle.com>
> Subject: Proposed API for JEP 259: Stack-Walking API
> Date: October 30, 2015 at 12:04:33 PM MST
> To: core-libs-dev <co...@openjdk.java.net>
>
> 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/
>
>
>
>
>
>
>
>
Re: Proposed API for JEP 259: Stack-Walking API
Posted by Ralph Goers <ra...@dslextreme.com>.
There are other ways to do it than using reflection.
Ralph
> On Nov 2, 2015, at 3:42 PM, Matt Sicker <bo...@gmail.com> wrote:
>
> I think reflection would still be necessary there unless we had a Java 8 and Java 9 version.
>
>> On 2 November 2015 at 16:40, Gary Gregory <ga...@gmail.com> wrote:
>> By the time Java 9 comes out I sure hope we'll have moved on to Java 8!
>>
>>> On Nov 2, 2015 2:33 PM, "Matt Sicker" <bo...@gmail.com> wrote:
>>> Looks nice. Might be a bit weird to support in a Java 7 environment through reflection, but it should be doable.
>>>
>>>> On 2 November 2015 at 13:57, Ralph Goers <ra...@dslextreme.com> wrote:
>>>> FYI
>>>>
>>>> Ralph
>>>>
>>>>> Begin forwarded message:
>>>>>
>>>>> From: Mandy Chung <ma...@oracle.com>
>>>>> Subject: Proposed API for JEP 259: Stack-Walking API
>>>>> Date: October 30, 2015 at 12:04:33 PM MST
>>>>> To: core-libs-dev <co...@openjdk.java.net>
>>>>>
>>>>> 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/
>>>
>>>
>>>
>>> --
>>> Matt Sicker <bo...@gmail.com>
>
>
>
> --
> Matt Sicker <bo...@gmail.com>
Re: Proposed API for JEP 259: Stack-Walking API
Posted by Matt Sicker <bo...@gmail.com>.
I think reflection would still be necessary there unless we had a Java 8
and Java 9 version.
On 2 November 2015 at 16:40, Gary Gregory <ga...@gmail.com> wrote:
> By the time Java 9 comes out I sure hope we'll have moved on to Java 8!
> On Nov 2, 2015 2:33 PM, "Matt Sicker" <bo...@gmail.com> wrote:
>
>> Looks nice. Might be a bit weird to support in a Java 7 environment
>> through reflection, but it should be doable.
>>
>> On 2 November 2015 at 13:57, Ralph Goers <ra...@dslextreme.com>
>> wrote:
>>
>>> FYI
>>>
>>> Ralph
>>>
>>> Begin forwarded message:
>>>
>>> *From: *Mandy Chung <ma...@oracle.com>
>>> *Subject: **Proposed API for JEP 259: Stack-Walking API*
>>> *Date: *October 30, 2015 at 12:04:33 PM MST
>>> *To: *core-libs-dev <co...@openjdk.java.net>
>>>
>>> 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/
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>
>>
>> --
>> Matt Sicker <bo...@gmail.com>
>>
>
--
Matt Sicker <bo...@gmail.com>
Re: Proposed API for JEP 259: Stack-Walking API
Posted by Gary Gregory <ga...@gmail.com>.
By the time Java 9 comes out I sure hope we'll have moved on to Java 8!
On Nov 2, 2015 2:33 PM, "Matt Sicker" <bo...@gmail.com> wrote:
> Looks nice. Might be a bit weird to support in a Java 7 environment
> through reflection, but it should be doable.
>
> On 2 November 2015 at 13:57, Ralph Goers <ra...@dslextreme.com>
> wrote:
>
>> FYI
>>
>> Ralph
>>
>> Begin forwarded message:
>>
>> *From: *Mandy Chung <ma...@oracle.com>
>> *Subject: **Proposed API for JEP 259: Stack-Walking API*
>> *Date: *October 30, 2015 at 12:04:33 PM MST
>> *To: *core-libs-dev <co...@openjdk.java.net>
>>
>> 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/
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>
>
> --
> Matt Sicker <bo...@gmail.com>
>
Re: Proposed API for JEP 259: Stack-Walking API
Posted by Matt Sicker <bo...@gmail.com>.
Looks nice. Might be a bit weird to support in a Java 7 environment through
reflection, but it should be doable.
On 2 November 2015 at 13:57, Ralph Goers <ra...@dslextreme.com> wrote:
> FYI
>
> Ralph
>
> Begin forwarded message:
>
> *From: *Mandy Chung <ma...@oracle.com>
> *Subject: **Proposed API for JEP 259: Stack-Walking API*
> *Date: *October 30, 2015 at 12:04:33 PM MST
> *To: *core-libs-dev <co...@openjdk.java.net>
>
> 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/
>
>
>
>
>
>
>
>
>
>
--
Matt Sicker <bo...@gmail.com>