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

Vicente Romero vromero at openjdk.org
Thu Nov 17 20:48:32 UTC 2022


On Thu, 20 Oct 2022 11:30:41 GMT, Aggelos Biboudis <abimpoudis at openjdk.org> wrote:

> 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`.

looks sensible

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

Marked as reviewed by vromero (Reviewer).

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


More information about the compiler-dev mailing list