Skip to content

Commit

Permalink
fix: avoid exceptions in clone
Browse files Browse the repository at this point in the history
  • Loading branch information
novoj committed Nov 29, 2024
1 parent aed040f commit 80e5697
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ public FilterInScope(@Nonnull Scope scope, @Nonnull FilterConstraint... filterin
Assert.isTrue(!ArrayUtils.isEmptyOrItsValuesNull(filtering), "At least one filtering constraint must be provided!");
}

private FilterInScope(@Nonnull Serializable[] arguments, @Nonnull FilterConstraint... children) {
super(CONSTRAINT_NAME, arguments, children);
}

/**
* Returns requested scope.
*/
Expand Down Expand Up @@ -119,6 +123,6 @@ public FilterConstraint getCopyWithNewChildren(@Nonnull FilterConstraint[] child
ArrayUtils.isEmpty(additionalChildren),
"Constraint InScope doesn't accept other than filtering constraints!"
);
return new FilterInScope(getScope(), children);
return new FilterInScope(new Serializable[] { getScope() }, children);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ public OrderInScope(@Nonnull Scope scope, @Nonnull OrderConstraint... ordering)
Assert.isTrue(!ArrayUtils.isEmptyOrItsValuesNull(ordering), "At least one ordering constraint must be provided!");
}

private OrderInScope(@Nonnull Serializable[] arguments, @Nonnull OrderConstraint... children) {
super(CONSTRAINT_NAME, arguments, children);
}

/**
* Returns requested scope.
*/
Expand Down Expand Up @@ -121,6 +125,6 @@ public OrderConstraint getCopyWithNewChildren(@Nonnull OrderConstraint[] childre
ArrayUtils.isEmpty(additionalChildren),
"Constraint InScope doesn't accept other than ordering constraints!"
);
return new OrderInScope(getScope(), children);
return new OrderInScope(new Serializable[] { getScope() }, children);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ public RequireInScope(@Nonnull Scope scope, @Nonnull @Child(uniqueChildren = tru
Assert.isTrue(!ArrayUtils.isEmptyOrItsValuesNull(require), "At least one require constraint must be provided!");
}

private RequireInScope(@Nonnull Serializable[] arguments, @Nonnull RequireConstraint... children) {
super(CONSTRAINT_NAME, arguments, children);
}

/**
* Returns requested scope.
*/
Expand Down Expand Up @@ -119,6 +123,6 @@ public RequireConstraint getCopyWithNewChildren(@Nonnull RequireConstraint[] chi
ArrayUtils.isEmpty(additionalChildren),
"Constraint InScope doesn't accept other than require constraints!"
);
return new RequireInScope(getScope(), children);
return new RequireInScope(new Serializable[] {getScope()}, children);
}
}

0 comments on commit 80e5697

Please sign in to comment.