RFR: Remove redundant null checks [v8]

Maurizio Cimadamore mcimadamore at openjdk.org
Mon Jan 26 11:29:58 UTC 2026


On Mon, 26 Jan 2026 10:43:48 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 with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 12 additional commits since the last revision:
> 
>  - Merge branch 'bworld' into remove.redundant.null.checks
>  - minor change
>  - addressing review comments
>  - adding test cases
>  - adding more tests
>  - adding more tests
>  - minor change
>  - another change
>  - regression tests
>  - remove redundant null checks
>  - ... and 2 more: https://git.openjdk.org/valhalla/compare/c2cb8abf...37939f06

src/jdk.compiler/share/classes/com/sun/tools/javac/comp/NullChecksWriter.java line 218:

> 216: 
> 217:     public void visitTypeCast(JCTypeCast tree) {
> 218:         boolean generateNullCheck = tree.strict;

Not sure this is still required -- `Attr` will filter this out anyway?

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

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


More information about the valhalla-dev mailing list