Skip to content

Commit

Permalink
Make AssertTrue and AssertFalse mutually exclusive
Browse files Browse the repository at this point in the history
Co-authored-by: Carsten Wickner <11309681+CarstenWickner@users.noreply.github.com>
  • Loading branch information
Nephery and CarstenWickner authored Jul 12, 2024
1 parent 00b9426 commit caca6b5
Showing 1 changed file with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -512,17 +512,15 @@ protected BigDecimal resolveNumberExclusiveMaximum(MemberScope<?, ?> member) {
* @see AssertFalse
*/
protected List<Object> resolveEnum(MemberScope<?, ?> member) {
List<Object> values = new ArrayList<>();

List<Object> values;
if (this.getAnnotationFromFieldOrGetter(member, AssertTrue.class, AssertTrue::groups) != null) {
values.add(true);
}

if (this.getAnnotationFromFieldOrGetter(member, AssertFalse.class, AssertFalse::groups) != null) {
values.add(false);
values = Collections.singletonList(true);
} else if (this.getAnnotationFromFieldOrGetter(member, AssertFalse.class, AssertFalse::groups) != null) {
values = Collections.singletonList(false);
} else {
values = null;
}

return values.isEmpty() ? null : values;
return values;
}

/**
Expand Down

0 comments on commit caca6b5

Please sign in to comment.