Use a switch expression for TreeType 62/103462/1
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 29 Nov 2022 15:17:23 +0000 (16:17 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 29 Nov 2022 15:20:40 +0000 (16:20 +0100)
Use exhaustiveness of a switch expression to peel an impossible case.

Change-Id: I7d1d228484656fc81b51762878d569698d570f80
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.java

index 9284224341aeb2a49d0c867ffc62938e3e6723a1..bcf09b3331d3525bdc76aae523a75d1f8adc2065 100644 (file)
@@ -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() {