Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,6 @@ public static void checkState(boolean expression, Supplier<String> errorMessageS
}
}

public static void checkState(boolean expression, LazyString errorMessage) {
if (!expression) {
throw new BadInputException(errorMessage.toString());
}
}


/**
* Ensures the truth of an expression involving the state of the calling instance, but not
* involving any parameters to the calling method.
Expand Down Expand Up @@ -156,15 +149,6 @@ public static void checkState(
}
}

public static void checkState(
boolean expression, XElement badElement, LazyString errorMessage) {
Preconditions.checkNotNull(badElement);
if (!expression) {
throw new BadInputException(errorMessage.toString(), badElement);
}
}


/**
* Ensures the truth of an expression involving the state of the calling instance, but not
* involving any parameters to the calling method.
Expand Down Expand Up @@ -198,37 +182,5 @@ public static void checkStateX(
}
}

/**
* Ensures the truth of an expression involving the state of the calling instance, but not
* involving any parameters to the calling method.
*
* @param expression a boolean expression
* @param badElements the elements that were at fault
* @param errorMessageSupplier the supplier to construct the exception message if the check fails
* @throws BadInputException if {@code expression} is false
*/
public static void checkStateX(
boolean expression,
Collection<? extends XElement> badElements,
LazyString errorMessageSupplier) {
Preconditions.checkNotNull(badElements);
if (!expression) {
Preconditions.checkState(!badElements.isEmpty());
throw new BadInputException(errorMessageSupplier.toString(), badElements);
}
}

public static void checkStateX(
boolean expression,
Collection<? extends XElement> badElements,
Supplier<String> errorMessageSupplier) {
Preconditions.checkNotNull(badElements);
if (!expression) {
Preconditions.checkState(!badElements.isEmpty());
throw new BadInputException(errorMessageSupplier.get(), badElements);
}
}


private ProcessorErrors() {}
}
Loading