RFR: JDK-8205418: Assorted improvements to source code model

Jonathan Gibbons jonathan.gibbons at oracle.com
Thu Jun 21 20:39:49 UTC 2018



On 06/21/2018 04:43 AM, Jan Lahoda wrote:
> Hi,
>
> I'd like to propose a few improvements to the source code model as 
> seen through the com.sun.source APIs.
>
> The changes include better error recovery, a fix end positions, and a 
> fix for Trees.getScope when used with a TreePath that point to a block 
> of a lambda expression, including cases where there's an error in the 
> source code.
>
> Bug: https://bugs.openjdk.java.net/browse/JDK-8205418
> Webrev: http://cr.openjdk.java.net/~jlahoda/8205418/webrev.00/
>
> How does this look?
>
> Thanks,
>    Jan

Generally OK.

In Operators:

Although the number of args is typically small, the following runs the 
stream twice:

  213         if (Stream.of(args).noneMatch(Type::isErroneous) &&
  214             Stream.of(args).noneMatch(t -> t == Type.recoveryType)) {

and could be simplified to

  213         if (Stream.of(args).noneMatch(t -> t.isErroneous || t == Type.recoveryType)) {


-- Jon


More information about the compiler-dev mailing list