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 <robert.varga@pantheon.tech>
* @author Robert Varga
*/
@Beta
* @author Robert Varga
*/
@Beta
-public abstract class IfFeatureExpr implements Immutable, Predicate<Set<QName>> {
- private abstract static class Single extends IfFeatureExpr {
+public abstract sealed class IfFeatureExpr implements Immutable, Predicate<Set<QName>> {
+ private abstract static sealed class Single extends IfFeatureExpr {
final QName qname;
Single(final QName qname) {
final QName qname;
Single(final QName qname) {
// 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
// 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<T> extends IfFeatureExpr {
+ private abstract static sealed class AbstractArray<T> extends IfFeatureExpr {
final T[] array;
AbstractArray(final T[] array) {
final T[] array;
AbstractArray(final T[] array) {
abstract String infix();
}
abstract String infix();
}
- private abstract static class Complex extends AbstractArray<IfFeatureExpr> {
+ private abstract static sealed class Complex extends AbstractArray<IfFeatureExpr> {
Complex(final IfFeatureExpr[] array) {
super(array);
}
Complex(final IfFeatureExpr[] array) {
super(array);
}
- private abstract static class Compound extends AbstractArray<QName> {
+ private abstract static sealed class Compound extends AbstractArray<QName> {
Compound(final QName[] qnames) {
super(qnames);
}
Compound(final QName[] qnames) {
super(qnames);
}
- private abstract static class AbstractAll extends Compound {
+ private abstract static sealed class AbstractAll extends Compound {
AbstractAll(final QName[] qnames) {
super(qnames);
}
AbstractAll(final QName[] qnames) {
super(qnames);
}
- private abstract static class AbstractAny extends Compound {
+ private abstract static sealed class AbstractAny extends Compound {
AbstractAny(final QName[] qnames) {
super(qnames);
}
AbstractAny(final QName[] qnames) {
super(qnames);
}