RFR: 8295447: NullPointerException with invalid pattern matching construct in constructor call

Aggelos Biboudis abimpoudis at openjdk.org
Thu Oct 20 11:40:23 UTC 2022


In the examples below:


int i = (o instanceof Bar(int x))? 0 : 1;
meth(i);



meth((o instanceof Bar(int x))? 0 : 1);


the error `DeconstructionPatternOnlyRecords` was reported only on the first case but the compiler was still crashing in both occasions. `NoType` was passed and `checkCastablePattern` was letting an erroneous type to pass through the subtyping checks. The proposed fix addresses that in `checkCastablePattern`.

-------------

Commit messages:
 - 8295447: NullPointerException with invalid pattern matching construct in constructor call

Changes: https://git.openjdk.org/jdk/pull/10791/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=10791&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8295447
  Stats: 57 lines in 3 files changed: 56 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/10791.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/10791/head:pull/10791

PR: https://git.openjdk.org/jdk/pull/10791


More information about the compiler-dev mailing list