diff --git a/java/src/org/openqa/selenium/edge/BUILD.bazel b/java/src/org/openqa/selenium/edge/BUILD.bazel index 7795baf9c1927..b8e8addb9c0cd 100644 --- a/java/src/org/openqa/selenium/edge/BUILD.bazel +++ b/java/src/org/openqa/selenium/edge/BUILD.bazel @@ -21,5 +21,6 @@ java_export( "//java/src/org/openqa/selenium/chromium", "//java/src/org/openqa/selenium/manager", "//java/src/org/openqa/selenium/remote", + "@maven//:org_jspecify_jspecify", ], ) diff --git a/java/src/org/openqa/selenium/edge/EdgeDriverService.java b/java/src/org/openqa/selenium/edge/EdgeDriverService.java index 4564ec8846d1e..e9752befce29f 100644 --- a/java/src/org/openqa/selenium/edge/EdgeDriverService.java +++ b/java/src/org/openqa/selenium/edge/EdgeDriverService.java @@ -29,6 +29,7 @@ import java.util.List; import java.util.Locale; import java.util.Map; +import org.jspecify.annotations.Nullable; import org.openqa.selenium.Capabilities; import org.openqa.selenium.WebDriverException; import org.openqa.selenium.chromium.ChromiumDriverLogLevel; @@ -96,11 +97,11 @@ public class EdgeDriverService extends DriverService { * @throws IOException If an I/O error occurs. */ public EdgeDriverService( - File executable, + @Nullable File executable, int port, - Duration timeout, - List args, - Map environment) + @Nullable Duration timeout, + @Nullable List args, + @Nullable Map environment) throws IOException { super(executable, port, timeout, List.copyOf(args), Map.copyOf(environment)); } @@ -139,13 +140,13 @@ public static EdgeDriverService createDefaultService() { @AutoService(DriverService.Builder.class) public static class Builder extends DriverService.Builder { - private Boolean disableBuildCheck; - private Boolean readableTimestamp; - private Boolean appendLog; - private Boolean verbose; - private Boolean silent; - private String allowedListIps; - private ChromiumDriverLogLevel logLevel; + @Nullable private Boolean disableBuildCheck; + @Nullable private Boolean readableTimestamp; + @Nullable private Boolean appendLog; + @Nullable private Boolean verbose; + @Nullable private Boolean silent; + @Nullable private String allowedListIps; + @Nullable private ChromiumDriverLogLevel logLevel; @Override public int score(Capabilities capabilities) { @@ -196,7 +197,7 @@ public Builder withBuildCheckDisabled(boolean noBuildCheck) { * @param logLevel {@link ChromiumDriverLogLevel} for desired log level output. * @return A self reference. */ - public Builder withLoglevel(ChromiumDriverLogLevel logLevel) { + public Builder withLoglevel(@Nullable ChromiumDriverLogLevel logLevel) { this.logLevel = logLevel; this.silent = false; this.verbose = false; @@ -238,7 +239,7 @@ public Builder withVerbose(boolean verbose) { * @param allowedListIps Comma-separated list of remote IPv4 addresses. * @return A self reference. */ - public Builder withAllowedListIps(String allowedListIps) { + public Builder withAllowedListIps(@Nullable String allowedListIps) { this.allowedListIps = allowedListIps; return this; } @@ -249,7 +250,7 @@ public Builder withAllowedListIps(String allowedListIps) { * @param readableTimestamp Whether the timestamp of the log is readable. * @return A self reference. */ - public Builder withReadableTimestamp(Boolean readableTimestamp) { + public Builder withReadableTimestamp(@Nullable Boolean readableTimestamp) { this.readableTimestamp = readableTimestamp; return this; } @@ -321,7 +322,11 @@ protected List createArgs() { @Override protected EdgeDriverService createDriverService( - File exe, int port, Duration timeout, List args, Map environment) { + @Nullable File exe, + int port, + @Nullable Duration timeout, + @Nullable List args, + @Nullable Map environment) { try { return new EdgeDriverService(exe, port, timeout, args, environment); } catch (IOException e) { diff --git a/java/src/org/openqa/selenium/remote/service/DriverService.java b/java/src/org/openqa/selenium/remote/service/DriverService.java index c62e9d08f998f..371a192fb9bdf 100644 --- a/java/src/org/openqa/selenium/remote/service/DriverService.java +++ b/java/src/org/openqa/selenium/remote/service/DriverService.java @@ -106,11 +106,11 @@ public class DriverService implements Closeable { * @throws IOException If an I/O error occurs. */ protected DriverService( - File executable, + @Nullable File executable, int port, - Duration timeout, - List args, - Map environment) + @Nullable Duration timeout, + @Nullable List args, + @Nullable Map environment) throws IOException { if (executable != null) { this.executable = executable.getCanonicalPath();