From 04502b115693e22d215716feef7b34b6d3c37f6a Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Tue, 29 Nov 2022 16:17:23 +0100 Subject: [PATCH] Use a switch expression for TreeType Use exhaustiveness of a switch expression to peel an impossible case. Change-Id: I7d1d228484656fc81b51762878d569698d570f80 Signed-off-by: Robert Varga --- .../controller/cluster/datastore/Shard.java | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.java index 9284224341..bcf09b3331 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.java @@ -1239,15 +1239,10 @@ public class Shard extends RaftActor { } public TreeType getTreeType() { - switch (datastoreContext.getLogicalStoreType()) { - case CONFIGURATION: - return TreeType.CONFIGURATION; - case OPERATIONAL: - return TreeType.OPERATIONAL; - default: - throw new IllegalStateException("Unhandled logical store type " - + datastoreContext.getLogicalStoreType()); - } + return switch (datastoreContext.getLogicalStoreType()) { + case CONFIGURATION -> TreeType.CONFIGURATION; + case OPERATIONAL -> TreeType.OPERATIONAL; + }; } protected void verify() { -- 2.36.6