Integrated: fixing bug in null checks generation

Vicente Romero vromero at openjdk.org
Thu Jan 29 13:37:08 UTC 2026


On Mon, 26 Jan 2026 15:59:29 GMT, Vicente Romero <vromero at openjdk.org> wrote:

> Javac is generating erroneous null checks for code like, test case provided by Jan:
> 
> 
> public class Main {
>     public String g() {
>         return Other.str = "";
>     }
> }
> class Other {
>     public static String! str = "";
> }
> 
> so there is no point in generating null checks on the left side of an assignment statement. So the proposal is to use a switch to indicate when null checks shouldn't be generated.
> 
> TIA

This pull request has now been integrated.

Changeset: 1702fdfd
Author:    Vicente Romero <vromero at openjdk.org>
URL:       https://git.openjdk.org/valhalla/commit/1702fdfd052d858442da48fbb0bd1ba1d66571e1
Stats:     127 lines in 3 files changed: 119 ins; 4 del; 4 mod

fixing bug in null checks generation

Co-authored-by: Jan Lahoda <jlahoda at openjdk.org>
Reviewed-by: jlahoda

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

PR: https://git.openjdk.org/valhalla/pull/1972


More information about the valhalla-dev mailing list