From 2c718dadc6bed8061c9e67d5d82f229e78ae4647 Mon Sep 17 00:00:00 2001 From: cpovirk Date: Wed, 1 Jul 2026 13:07:30 -0700 Subject: [PATCH] Introduce minimal Refaster support for [unnamed variables](https://openjdk.org/jeps/456). There is probably more to be worked out here, even to decide upon the full set of desired behaviors. But it's nice to at least not crash. PiperOrigin-RevId: 941255538 --- .../java/com/google/errorprone/refaster/UVariableDecl.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/src/main/java/com/google/errorprone/refaster/UVariableDecl.java b/core/src/main/java/com/google/errorprone/refaster/UVariableDecl.java index d57828aa610..4357fc62f32 100644 --- a/core/src/main/java/com/google/errorprone/refaster/UVariableDecl.java +++ b/core/src/main/java/com/google/errorprone/refaster/UVariableDecl.java @@ -131,6 +131,9 @@ private JCVariableDecl inline(@Nullable UExpression type, Inliner inliner) modifiers = maker.Modifiers(0L); name = getName().inline(inliner); } + if (name.isEmpty()) { + name = inliner.asName("_"); + } return maker.VarDef( modifiers, name,