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

Jan Lahoda jan.lahoda at oracle.com
Fri Jun 22 11:30:33 UTC 2018


On 21.6.2018 22:39, Jonathan Gibbons wrote:
>
>
> 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)) {

Thanks Jon, will do (changing t == recoveryType to 
t.hasTag(TypeTag.NONE) as Maurizio suggested).

Jan

>
>
> -- Jon


More information about the compiler-dev mailing list