On Mon, 26 Jan 2026 15:59:29 GMT, Vicente Romero <[email protected]> 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 <[email protected]>
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 <[email protected]>
Reviewed-by: jlahoda

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

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

Reply via email to