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 cdc404c commit 88fcde3
Showing 1 changed file with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;

import org.graalvm.nativeimage.hosted.Feature;
Expand All @@ -38,14 +39,8 @@ public abstract class ConditionalConfigurationRegistry {
private final Map<String, List<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 88fcde3

Please sign in to comment.