RFR: 8312984: javac may crash on a record pattern with too few components
Vicente Romero
vromero at openjdk.org
Wed Aug 2 19:37:42 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.
looks sensible
-------------
Marked as reviewed by vromero (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/15024#pullrequestreview-1559719602
More information about the compiler-dev
mailing list