Integrated: 8312984: javac may crash on a record pattern with too few components
Jan Lahoda
jlahoda at openjdk.org
Thu Aug 3 08:40:39 UTC 2023
On Tue, 25 Jul 2023 18:08:36 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:
> 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.
This pull request has now been integrated.
Changeset: c3860917
Author: Jan Lahoda <jlahoda at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/c3860917346fb53ed3d23f11d112b58b8cd8448a
Stats: 19 lines in 4 files changed: 14 ins; 0 del; 5 mod
8312984: javac may crash on a record pattern with too few components
Reviewed-by: vromero
-------------
PR: https://git.openjdk.org/jdk/pull/15024
More information about the compiler-dev
mailing list