Skip to content

[java] Feat 14291/jspecify nullable annotation edge driver service #15972

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions java/src/org/openqa/selenium/edge/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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",
],
)
35 changes: 20 additions & 15 deletions java/src/org/openqa/selenium/edge/EdgeDriverService.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<String> args,
Map<String, String> environment)
@Nullable Duration timeout,
@Nullable List<String> args,
@Nullable Map<String, String> environment)
throws IOException {
super(executable, port, timeout, List.copyOf(args), Map.copyOf(environment));
}
Expand Down Expand Up @@ -139,13 +140,13 @@ public static EdgeDriverService createDefaultService() {
@AutoService(DriverService.Builder.class)
public static class Builder extends DriverService.Builder<EdgeDriverService, 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) {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down Expand Up @@ -321,7 +322,11 @@ protected List<String> createArgs() {

@Override
protected EdgeDriverService createDriverService(
File exe, int port, Duration timeout, List<String> args, Map<String, String> environment) {
@Nullable File exe,
int port,
@Nullable Duration timeout,
@Nullable List<String> args,
@Nullable Map<String, String> environment) {
try {
return new EdgeDriverService(exe, port, timeout, args, environment);
} catch (IOException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> args,
Map<String, String> environment)
@Nullable Duration timeout,
@Nullable List<String> args,
@Nullable Map<String, String> environment)
throws IOException {
if (executable != null) {
this.executable = executable.getCanonicalPath();
Expand Down