RFR: 8250625: Compiler implementation of Pattern Matching for instanceof (Final)

Jan Lahoda jlahoda at openjdk.java.net
Tue Oct 20 11:39:19 UTC 2020

On Tue, 20 Oct 2020 03:09:27 GMT, Vicente Romero <vromero at openjdk.org> wrote:

>> This is the current proposed patch for the upcoming JEP 394, for pattern matching for instanceof.
>> A summary of changes:
>> -making the feature permanent (non-preview)
>> -making the binding variables non-final (as per current specification proposal)
>> -producing a compile-time error for the case where the expression's type is a subtype of the type test pattern's type
>>  (as per current specification proposal)
>> -changing the AST structure so that the binding variable has a VariableTree in the AST. BindingPatternTree is preserved
>>  and encloses the VariableTree. The reason is better consistency in the API, with nodes like CatchTree, EnhancedForLoop
>>  Tree, etc.
>> This change will not be integrated until JEP 394 is targetted.
> test/langtools/tools/javac/patterns/LocalVariableTable.java line 29:
>> 27:  * @summary Ensure the LV table entries are generated for bindings
>> 28:  * @modules jdk.jdeps/com.sun.tools.classfile
>> 29:  * @compile -g LocalVariableTable.java
> I believe all tests are always compiled with `-g` option set, not related to your patch but we could probably remove
> that line as superfluous

I believe plain jtreg invocations may not be always setting "-g". So probably better to be explicitly clear we need -g,
as the test itself requires the debugging info/LocalVariableTable?


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

More information about the compiler-dev mailing list