diff --git a/java/src/org/openqa/selenium/safari/BUILD.bazel b/java/src/org/openqa/selenium/safari/BUILD.bazel index d0ede1b60e216..cc1d258de355b 100644 --- a/java/src/org/openqa/selenium/safari/BUILD.bazel +++ b/java/src/org/openqa/selenium/safari/BUILD.bazel @@ -14,5 +14,6 @@ java_export( "//java:auto-service", "//java/src/org/openqa/selenium:core", "//java/src/org/openqa/selenium/remote", + "@maven//:org_jspecify_jspecify", ], ) diff --git a/java/src/org/openqa/selenium/safari/SafariDriverService.java b/java/src/org/openqa/selenium/safari/SafariDriverService.java index e2ee960ffecda..4e0b4f2bdf674 100644 --- a/java/src/org/openqa/selenium/safari/SafariDriverService.java +++ b/java/src/org/openqa/selenium/safari/SafariDriverService.java @@ -32,6 +32,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import org.jspecify.annotations.Nullable; import org.openqa.selenium.Capabilities; import org.openqa.selenium.WebDriverException; import org.openqa.selenium.net.PortProber; @@ -64,11 +65,11 @@ public class SafariDriverService extends DriverService { * @throws IOException If an I/O error occurs. */ public SafariDriverService( - 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, @@ -126,7 +127,7 @@ protected void waitUntilAvailable() { public static class Builder extends DriverService.Builder { - private Boolean diagnose; + private @Nullable Boolean diagnose; @Override public int score(Capabilities capabilities) { @@ -139,13 +140,13 @@ public int score(Capabilities capabilities) { return score; } - public Builder withLogging(Boolean logging) { + public Builder withLogging(@Nullable Boolean logging) { this.diagnose = logging; return this; } @Override - public Builder withLogFile(File logFile) { + public Builder withLogFile(@Nullable File logFile) { throw new WebDriverException( "Can not set log location for Safari; use withLogging(true) and locate log in" + " ~/Library/Logs/com.apple.WebDriver/"); @@ -169,7 +170,11 @@ protected List createArgs() { @Override protected SafariDriverService 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 { withLogOutput(OutputStream.nullOutputStream()); return new SafariDriverService(exe, port, timeout, args, environment);