Skip to content

Commit e2958fd

Browse files
iampopovichdiemol
andauthored
[java] Add JSpecify nullable annotations to SafariDriverService parameters (#16000)
Add JSpecify nullable annotations to SafariDriverService parameters Co-authored-by: Diego Molina <[email protected]>
1 parent 16971b4 commit e2958fd

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

java/src/org/openqa/selenium/safari/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ java_export(
1414
"//java:auto-service",
1515
"//java/src/org/openqa/selenium:core",
1616
"//java/src/org/openqa/selenium/remote",
17+
"@maven//:org_jspecify_jspecify",
1718
],
1819
)

java/src/org/openqa/selenium/safari/SafariDriverService.java

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import java.util.HashMap;
3333
import java.util.List;
3434
import java.util.Map;
35+
import org.jspecify.annotations.Nullable;
3536
import org.openqa.selenium.Capabilities;
3637
import org.openqa.selenium.WebDriverException;
3738
import org.openqa.selenium.net.PortProber;
@@ -64,11 +65,11 @@ public class SafariDriverService extends DriverService {
6465
* @throws IOException If an I/O error occurs.
6566
*/
6667
public SafariDriverService(
67-
File executable,
68+
@Nullable File executable,
6869
int port,
69-
Duration timeout,
70-
List<String> args,
71-
Map<String, String> environment)
70+
@Nullable Duration timeout,
71+
@Nullable List<String> args,
72+
@Nullable Map<String, String> environment)
7273
throws IOException {
7374
super(
7475
executable,
@@ -126,7 +127,7 @@ protected void waitUntilAvailable() {
126127
public static class Builder
127128
extends DriverService.Builder<SafariDriverService, SafariDriverService.Builder> {
128129

129-
private Boolean diagnose;
130+
private @Nullable Boolean diagnose;
130131

131132
@Override
132133
public int score(Capabilities capabilities) {
@@ -139,13 +140,13 @@ public int score(Capabilities capabilities) {
139140
return score;
140141
}
141142

142-
public Builder withLogging(Boolean logging) {
143+
public Builder withLogging(@Nullable Boolean logging) {
143144
this.diagnose = logging;
144145
return this;
145146
}
146147

147148
@Override
148-
public Builder withLogFile(File logFile) {
149+
public Builder withLogFile(@Nullable File logFile) {
149150
throw new WebDriverException(
150151
"Can not set log location for Safari; use withLogging(true) and locate log in"
151152
+ " ~/Library/Logs/com.apple.WebDriver/");
@@ -169,7 +170,11 @@ protected List<String> createArgs() {
169170

170171
@Override
171172
protected SafariDriverService createDriverService(
172-
File exe, int port, Duration timeout, List<String> args, Map<String, String> environment) {
173+
@Nullable File exe,
174+
int port,
175+
@Nullable Duration timeout,
176+
@Nullable List<String> args,
177+
@Nullable Map<String, String> environment) {
173178
try {
174179
withLogOutput(OutputStream.nullOutputStream());
175180
return new SafariDriverService(exe, port, timeout, args, environment);

0 commit comments

Comments
 (0)