RFR 8075207: Nashorn parser API returns StatementTree objects in out of order

Remi Forax forax at univ-mlv.fr
Mon Mar 16 10:40:33 UTC 2015


Hi Sundar,
Looks good !

just nitpicking, Java 8 introduces a method sort() on List so instead of
Collections.sort(statList, (s1, s2)->(s1.getStart() - s2.getStart()));

one can write
statList.sort((s1, s2)->Integer.compare(s1.getStart(), s2.getStart()));
(Integer.compare() is used avoid the overflow problem)

or with a method reference,
statList.sort(Comparator.comparingInt(Statement::getStart));

cheers,
Rémi


On 03/16/2015 11:21 AM, A. Sundararajan wrote:
> Please review http://cr.openjdk.java.net/~sundar/8075207/ for 
> https://bugs.openjdk.java.net/browse/JDK-8075207
>
> PS. Piggybacking few @Override and other clean-ups..
>
> Thanks,
> -Sundar



More information about the nashorn-dev mailing list