aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2024-04-05 12:32:42 +0200
committerHenning Baldersheim <balder@yahoo-inc.com>2024-04-05 12:32:42 +0200
commitac74f412e4ba301a7fa4aef56eac425dd563d325 (patch)
tree97b13ed26aa283d8bed7d777b55633d1cde4dcc7
parentafc48db2391cd2c803438fb936c02a4001b0e0e0 (diff)
Use pattern variable.
-rw-r--r--container-core/src/main/java/com/yahoo/container/di/componentgraph/core/ComponentNode.java6
1 files changed, 2 insertions, 4 deletions
diff --git a/container-core/src/main/java/com/yahoo/container/di/componentgraph/core/ComponentNode.java b/container-core/src/main/java/com/yahoo/container/di/componentgraph/core/ComponentNode.java
index 3ed02fad6c5..4500a5636f4 100644
--- a/container-core/src/main/java/com/yahoo/container/di/componentgraph/core/ComponentNode.java
+++ b/container-core/src/main/java/com/yahoo/container/di/componentgraph/core/ComponentNode.java
@@ -165,8 +165,7 @@ public class ComponentNode extends Node {
}
private Object initId(Object component) {
- if (component instanceof AbstractComponent) {
- AbstractComponent abstractComponent = (AbstractComponent) component;
+ if (component instanceof AbstractComponent abstractComponent) {
if (abstractComponent.hasInitializedId() && !abstractComponent.getId().equals(componentId())) {
throw new IllegalStateException(
"Component with id '" + componentId() + "' is trying to set its component id explicitly: '" + abstractComponent.getId() + "'. " +
@@ -199,8 +198,7 @@ public class ComponentNode extends Node {
@Override
public boolean equals(Object other) {
- if (other instanceof ComponentNode) {
- ComponentNode that = (ComponentNode) other;
+ if (other instanceof ComponentNode that) {
return super.equals(that) && equalEdges(Arrays.asList(this.arguments), Arrays.asList(that.arguments)) && this.usedConfigs().equals(that.usedConfigs());
} else {
return false;