Run IntelliJ's "Pattern variable can be used" inspection on entire codebase.
This is a machine-generated CL.
Bazel does a lot of downcasting, much of it necessary due to the runtime-dynamic and configurable nature of the system. Using JEP394 to ergonomically downcast saves a line of distracting boilerplate which adds up with hundreds of downcasts.
#jdk21 #jep394
PiperOrigin-RevId: 625454340
Change-Id: I4f21253f855128df271a100ec19a578d5af1ec1c
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/BuildDriverKey.java b/src/main/java/com/google/devtools/build/lib/skyframe/BuildDriverKey.java
index 75c3a36..74bfd90 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/BuildDriverKey.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/BuildDriverKey.java
@@ -121,8 +121,7 @@
@Override
public boolean equals(Object other) {
- if (other instanceof BuildDriverKey) {
- BuildDriverKey otherBuildDriverKey = (BuildDriverKey) other;
+ if (other instanceof BuildDriverKey otherBuildDriverKey) {
return actionLookupKey.equals(otherBuildDriverKey.actionLookupKey)
&& topLevelArtifactContext.equals(otherBuildDriverKey.topLevelArtifactContext)
&& explicitlyRequested == otherBuildDriverKey.explicitlyRequested;