RFR: Remove redundant null checks [v7]

Vicente Romero vromero at openjdk.org
Fri Jan 23 19:05:20 UTC 2026


On Fri, 23 Jan 2026 19:02:22 GMT, Vicente Romero <vromero at openjdk.org> wrote:

>> some of the null checks javac generates are redundant and can be removed
>
> Vicente Romero has updated the pull request incrementally with one additional commit since the last revision:
> 
>   minor change

src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java line 4564:

> 4562:             owntype = cfolder.coerce(exprtype, owntype);
> 4563:         result = check(tree, capture(owntype), KindSelector.VAL, resultInfo);
> 4564:         if (types.isNonNullable(clazztype) || tree.expr instanceof JCTypeCast typeCast && typeCast.strict) {

bubble up the `strict` flag one strict cast make all chained casts strict

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

PR Review Comment: https://git.openjdk.org/valhalla/pull/1947#discussion_r2722470245


More information about the valhalla-dev mailing list