Skip to content

Commit

Permalink
Use Objects.requireNonNull() in ConditionalConfigurationRegistry.
Browse files Browse the repository at this point in the history
(cherry picked from commit 0ba6cc2)
  • Loading branch information
fniephaus authored and zakkak committed Dec 18, 2023
1 parent 2b80dd7 commit 4104ef1
Showing 1 changed file with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

import java.util.Collection;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentLinkedQueue;

Expand All @@ -38,14 +39,8 @@ public abstract class ConditionalConfigurationRegistry {
private final Map<String, Collection<Runnable>> pendingReachabilityHandlers = new ConcurrentHashMap<>();

protected void registerConditionalConfiguration(ConfigurationCondition condition, Runnable runnable) {
if (condition == null) {
throw new NullPointerException("Cannot use null value as condition for conditional configuration. " +
"Please ensure that you register a non-null condition.");
}
if (runnable == null) {
throw new NullPointerException("Cannot use null value as runnable for conditional configuration. " +
"Please ensure that you register a non-null runnable.");
}
Objects.requireNonNull(condition, "Cannot use null value as condition for conditional configuration. Please ensure that you register a non-null condition.");
Objects.requireNonNull(runnable, "Cannot use null value as runnable for conditional configuration. Please ensure that you register a non-null runnable.");
if (ConfigurationCondition.alwaysTrue().equals(condition)) {
/* analysis optimization to include new types as early as possible */
runnable.run();
Expand Down

0 comments on commit 4104ef1

Please sign in to comment.