RFR: 8314578: Non-verifiable code is emitted when two guards declare pattern variables in colon-switch
Aggelos Biboudis
abimpoudis at openjdk.org
Mon Oct 2 10:19:40 UTC 2023
In the following example while the case pattern does not introduce binding variable, the guard does. `hasBindings` has been updated accordingly to accept any trees and check them if they contain a `visitBindingPattern`. Not only `JCPattern`'s.
static void test(Object o) {
switch (o) {
case R1() when o instanceof String s:
case R2() when o instanceof Integer i:
System.out.println("hello: " + i);
break;
default:
break;
}
}
-------------
Commit messages:
- 8314578: Non-verifiable code is emitted when two guards declare pattern variables in colon-switch
Changes: https://git.openjdk.org/jdk/pull/15630/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=15630&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8314578
Stats: 41 lines in 3 files changed: 38 ins; 0 del; 3 mod
Patch: https://git.openjdk.org/jdk/pull/15630.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/15630/head:pull/15630
PR: https://git.openjdk.org/jdk/pull/15630
More information about the compiler-dev
mailing list