Use instanceof pattern DefaultChoiceRuntimeType 52/109352/2
authorRobert Varga <robert.varga@pantheon.tech>
Sat, 16 Dec 2023 13:35:00 +0000 (14:35 +0100)
committerRobert Varga <nite@hq.sk>
Sat, 16 Dec 2023 15:34:41 +0000 (15:34 +0000)
Remove an explicit cast in favor of an instanceof pattern.

Change-Id: Iffe0425ba48a43396667354d4d7b22f882301445
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
binding/mdsal-binding-generator/src/main/java/org/opendaylight/mdsal/binding/generator/impl/rt/DefaultChoiceRuntimeType.java

index 3470b96f489b3fa923f7152682c9e8a121662b3a..3c686287965d8e0f8cedd9463ab8f9fb91574db8 100644 (file)
@@ -32,6 +32,6 @@ public final class DefaultChoiceRuntimeType extends AbstractCompositeRuntimeType
     @Override
     public CaseRuntimeType bindingCaseChild(final JavaTypeName typeName) {
         final var child = bindingChild(typeName);
-        return child instanceof CaseRuntimeType ? (CaseRuntimeType) child : null;
+        return child instanceof CaseRuntimeType caseChild ? caseChild : null;
     }
 }