On Wed, 21 Oct 2020 03:12:08 GMT, Vicente Romero <vrom...@openjdk.org> wrote:

>> Jan Lahoda has updated the pull request with a new target base due to a 
>> merge or a rebase. The incremental webrev excludes the unrelated changes 
>> brought in by the merge/rebase. The pull request contains 15 additional 
>> commits since the last revision:
>> 
>>  - Cleanup: using a null instead of List.of() as a parameter to 
>> JavaCompiler.getTask
>>  - Merge branch 'master' into patterns-instanceof3
>>  - Fixing more tests.
>>  - Correcting positions.
>>  - Improve the AST model.
>>  - Merge branch 'master' into patterns-instanceof3
>>  - Updating @since tags.
>>  - Merge branch 'master' into patterns-instanceof3
>>  - Cleaning up preview comments in javadoc.
>>  - Merge branch 'master' into patterns-instanceof3
>>  - ... and 5 more: 
>> https://git.openjdk.java.net/jdk/compare/efd3730b...5978bca0
>
> src/jdk.compiler/share/classes/com/sun/source/tree/PatternTree.java line 29:
> 
>> 27: 
>> 28: /**
>> 29:  * A tree node used as the base class for the different kinds of
> 
> the javadoc seems to need an update, probably:
> `A tree node used as the base class for the different kinds of pattern 
> matching expressions`?

Patterns are not really expressions - they are a new kind of trees. Basically, 
before we had "statements" and "expressions" (+declarations, which are a bit 
special, ClassTree and VariableTree are "statements", but MethodTree, 
ModuleTree and PackageTree subtype Tree directly, so there is no common 
supertype). Now we have "patterns" in addition to that.

For example, having: `o instanceof String s`, this is an expression, but 
`String s` is not - it is a pattern. It cannot stand on its own as an 
expression, it is a special part of the expression.

-------------

PR: https://git.openjdk.java.net/jdk/pull/559

Reply via email to