Integrated: generate null checks for intersections for which at least one component is null restricted
Vicente Romero
vromero at openjdk.org
Mon Jan 12 17:37:31 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
This pull request has now been integrated.
Changeset: b0e093b8
Author: Vicente Romero <vromero at openjdk.org>
URL: https://git.openjdk.org/valhalla/commit/b0e093b8b98c926e5322ad5b5ebcef767e17ab85
Stats: 18 lines in 2 files changed: 18 ins; 0 del; 0 mod
generate null checks for intersections for which at least one component is null restricted
Reviewed-by: mcimadamore
-------------
PR: https://git.openjdk.org/valhalla/pull/1881
More information about the valhalla-dev
mailing list