Proposed API for JEP 259: Stack-Walking API

Remi Forax forax at univ-mlv.fr
Sat Oct 31 18:29:40 UTC 2015


Hi Mandy,
I've crawled the code and the documentation again.

In the doc and in the code, a lambda with one parameter doesn't require parenthesis around the parameter,
  (s) -> s.doSomething()
should be
  s -> s.doSomething().


In the doc of StackWalker,
 in the first example, the local variable 'frame' should be named 'callerClass'


In the doc of getCallerClass(),
 the first example do a skip(2) which i believe is not necessary anymore,
 also instead of Optional.orElse, orElseGet is better because it avoids to evaluate
 Thread.currentThread().getClass() if not necessary.

 So the example should be:
   walk(s -> s.map(StackFrame::getDeclaringClass)
              .findFirst()).orElseGet(() -> Thread.currentThread().getClass());

 In the second example, the field walker should be declared 'final'.


And as i said earlier, the signature of walk() is:
  <T> T walk(Function<? super Stream<StackWalker.StackFrame>, ? extends T> function, IntUnaryOperator batchSizeMapper)

cheers,
Rémi

----- Mail original -----
> De: forax at univ-mlv.fr
> À: "Mandy Chung" <mandy.chung at oracle.com>
> Cc: core-libs-dev at openjdk.java.net
> Envoyé: Samedi 31 Octobre 2015 19:06:11
> Objet: Re: Proposed API for JEP 259: Stack-Walking API
> 
> Hi Mandy,
> 
> ----- Mail original -----
> > De: "Mandy Chung" <mandy.chung at oracle.com>
> > À: "Remi Forax" <forax at univ-mlv.fr>, "David M. Lloyd"
> > <david.lloyd at redhat.com>
> > Cc: core-libs-dev at openjdk.java.net
> > Envoyé: Vendredi 30 Octobre 2015 23:35:02
> > Objet: Re: Proposed API for JEP 259: Stack-Walking API
> > 
> > 
> > > On Oct 30, 2015, at 1:26 PM, Remi Forax <forax at univ-mlv.fr> wrote:
> > > 
> > > In StackWalker.Option,
> > > i think that CLASS_REFERENCE can be renamed to KEEP_CLASS_REFERENCE,
> > > maybe
> > > ?
> > 
> > What about RETAIN_CLASS_REFERENCE?
> 
> yes, it's a better name.
> 
> > 
> > I have updated the javadoc in place:
> >   http://cr.openjdk.java.net/~mchung/jdk9/jep259/api/java/lang/StackWalker.html
> > 
> > Changes include:
> > - CLASS_REFERENCE renamed to RETAIN_CLASS_REFERENCE
> > - remove StackWalker.WalkerOption interface
> > - the batchSizeMapper argument is of IntUnaryOperator type.
> > 
> > Thanks for the feedback, Remi and David.
> > Mandy
> 
> Rémi
> 



More information about the core-libs-dev mailing list