RFR: generate null checks for intersections for which at least one component is null restricted
Maurizio Cimadamore
mcimadamore at openjdk.org
Mon Jan 12 17:35:23 UTC 2026
On Fri, 9 Jan 2026 23:35:35 GMT, Vicente Romero <vromero at openjdk.org> wrote:
> javac should generate a null check for code like:
>
>
> class Test {
> public static void main(String... args) {
> Object s = null;
> Object o = (String & Runnable!) s; // NPE, cast
> }
> }
>
> the idea of the fix is to consider an intersection null restricted if at least one of its components is null restricted
Looks good
-------------
Marked as reviewed by mcimadamore (Committer).
PR Review: https://git.openjdk.org/valhalla/pull/1881#pullrequestreview-3651909016
More information about the valhalla-dev
mailing list