RFR: Remove redundant null checks [v5]

Vicente Romero vromero at openjdk.org
Fri Jan 23 13:36:16 UTC 2026


On Fri, 23 Jan 2026 10:05:37 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> Vicente Romero has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   adding more tests
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/comp/NullChecksWriter.java line 213:
> 
>> 211: 
>> 212:         private boolean isInThisSameCompUnit(Symbol sym) {
>> 213:             return env.toplevel.getTypeDecls().stream()
> 
> Isn't this the same as `env.enclClass.sym.outermostClass() == sym.outermostClass()` ?

not sure, what if there are more than one top level class in the same compilation unit?

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

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


More information about the valhalla-dev mailing list