On Sun, 11 Jan 2026 00:52:12 GMT, Vicente Romero <[email protected]> wrote:

> fixing some bugs in NullChecksWriter, reported by John Rose. In particular 
> there was no null check being generated by javac for code like:
> 
> 
> class Test {
>     void m(String someObject) {
>         String! x = "foo";
>         x = (String)someObject;  // no null check generated here
>     }
> 
>     public static void main(String... args) {
>         new Test().m(null);
>     }
> }

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

> 1: /*

visitReturn has the same issue: it checks whether the return expression has a 
symbol and only generates a null check if there's one.

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

PR Review Comment: 
https://git.openjdk.org/valhalla/pull/1883#discussion_r2681542531

Reply via email to