From bb1697b4f7a418b328f40ea11712dc1efa5ce2a5 Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Tue, 17 May 2022 22:55:44 +0200 Subject: [PATCH] Seal IfFeatureExpr IfFeatureExpr is not final due to implementation subclasses. Make sure it cannot be mocked or subclassed by sealing it. Change-Id: I9146094c9e139c4ee1a5f7fc6a59e6058356a969 Signed-off-by: Robert Varga --- .../yang/model/api/stmt/IfFeatureExpr.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/model/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/IfFeatureExpr.java b/model/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/IfFeatureExpr.java index 37c1d737e3..da16c843b8 100644 --- a/model/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/IfFeatureExpr.java +++ b/model/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/IfFeatureExpr.java @@ -36,8 +36,8 @@ import org.opendaylight.yangtools.yang.common.QName; * @author Robert Varga */ @Beta -public abstract class IfFeatureExpr implements Immutable, Predicate> { - private abstract static class Single extends IfFeatureExpr { +public abstract sealed class IfFeatureExpr implements Immutable, Predicate> { + private abstract static sealed class Single extends IfFeatureExpr { final QName qname; Single(final QName qname) { @@ -68,7 +68,7 @@ public abstract class IfFeatureExpr implements Immutable, Predicate> // We are using arrays to hold our components to save a wee bit of space. The arrays originate from Sets retaining // insertion order of Lists, each component is guaranteed to be unique, in definition order, not appearing multiple // times - private abstract static class AbstractArray extends IfFeatureExpr { + private abstract static sealed class AbstractArray extends IfFeatureExpr { final T[] array; AbstractArray(final T[] array) { @@ -90,7 +90,7 @@ public abstract class IfFeatureExpr implements Immutable, Predicate> abstract String infix(); } - private abstract static class Complex extends AbstractArray { + private abstract static sealed class Complex extends AbstractArray { Complex(final IfFeatureExpr[] array) { super(array); } @@ -129,7 +129,7 @@ public abstract class IfFeatureExpr implements Immutable, Predicate> } } - private abstract static class Compound extends AbstractArray { + private abstract static sealed class Compound extends AbstractArray { Compound(final QName[] qnames) { super(qnames); } @@ -256,7 +256,7 @@ public abstract class IfFeatureExpr implements Immutable, Predicate> } } - private abstract static class AbstractAll extends Compound { + private abstract static sealed class AbstractAll extends Compound { AbstractAll(final QName[] qnames) { super(qnames); } @@ -310,7 +310,7 @@ public abstract class IfFeatureExpr implements Immutable, Predicate> } } - private abstract static class AbstractAny extends Compound { + private abstract static sealed class AbstractAny extends Compound { AbstractAny(final QName[] qnames) { super(qnames); } -- 2.36.6