RFR: 8312984: javac may crash on a record pattern with too few components
Jan Lahoda
jlahoda at openjdk.org
Tue Jul 25 18:15:58 UTC 2023
Processing code like:
public class Err {
record R(String x) {}
public void(Object obj) {
switch(obj) {
case R(var v, ) -> 1; //note the missing component/nested pattern
}
}
}
may crash with an ArrayIndexOutOfBoundsException, because requesting component type for a non-existing component, while evaluating exhaustivity.
The proposal is to simply use `errType` for this case, to prevent the crash.
-------------
Commit messages:
- 8312984: javac may crash on a record pattern with too few components
Changes: https://git.openjdk.org/jdk/pull/15024/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=15024&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8312984
Stats: 19 lines in 4 files changed: 14 ins; 0 del; 5 mod
Patch: https://git.openjdk.org/jdk/pull/15024.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/15024/head:pull/15024
PR: https://git.openjdk.org/jdk/pull/15024
More information about the compiler-dev
mailing list