On Fri, 3 Apr 2026 06:04:03 GMT, Chen Liang <[email protected]> wrote:
>> This is the proposed patch for Enhanced Local Variable Declarations >> (Preview). >> >> - [x] I confirm that I make this contribution in accordance with the >> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai). > > src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransPatterns.java > line 1195: > >> 1193: >> 1194: // npe logic >> 1195: JCIf ifNPEstatement = make.If(makeBinary(Tag.EQ, >> letBoundCandidateIdent, makeNull()).setType(syms.booleanType), > > Why not `attr.makeNullCheck`? Redundant NPE type for Symtab too. Was thinking same thing as @liach -- javac uses special node (unary ops) to perform null checks, which are translated as `Objects.requireNonNull`. It is generally a better translation for the VM than doing the check manually as here -- and it's simpler for the code here too. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/30556#discussion_r3167140652
