Skip to content
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/ie/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ java_export(
"//java/src/org/openqa/selenium:core",
"//java/src/org/openqa/selenium/manager",
"//java/src/org/openqa/selenium/remote",
"@maven//:org_jspecify_jspecify",
],
)
20 changes: 7 additions & 13 deletions java/src/org/openqa/selenium/ie/InternetExplorerDriver.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

package org.openqa.selenium.ie;

import org.jspecify.annotations.Nullable;
import org.openqa.selenium.Beta;
import org.openqa.selenium.Capabilities;
import org.openqa.selenium.Platform;
Expand Down Expand Up @@ -108,20 +109,13 @@ public InternetExplorerDriver(
* @param options The options required from InternetExplorerDriver.
*/
public InternetExplorerDriver(
InternetExplorerDriverService service,
InternetExplorerOptions options,
ClientConfig clientConfig) {
if (options == null) {
options = new InternetExplorerOptions();
}
if (service == null) {
service = InternetExplorerDriverService.createDefaultService();
}
@Nullable InternetExplorerDriverService service,
@Nullable InternetExplorerOptions options,
@Nullable ClientConfig clientConfig) {
options = options == null ? new InternetExplorerOptions() : options;
service = service == null ? InternetExplorerDriverService.createDefaultService() : service;
clientConfig = clientConfig == null ? ClientConfig.defaultConfig() : clientConfig;
service.setExecutable(new DriverFinder(service, options).getDriverPath());
if (clientConfig == null) {
clientConfig = ClientConfig.defaultConfig();
}

run(service, options, clientConfig);
}

Expand Down
1 change: 1 addition & 0 deletions java/src/org/openqa/selenium/remote/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ java_library(
"//java/src/org/openqa/selenium/support/decorators",
artifact("com.google.guava:guava"),
artifact("net.bytebuddy:byte-buddy"),
artifact("org.jspecify:jspecify"),
],
)

Expand Down
17 changes: 7 additions & 10 deletions java/src/org/openqa/selenium/remote/DesiredCapabilities.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import static org.openqa.selenium.remote.CapabilityType.PLATFORM_NAME;

import java.util.Map;
import java.util.Optional;
import org.jspecify.annotations.Nullable;
import org.openqa.selenium.Capabilities;
import org.openqa.selenium.MutableCapabilities;
import org.openqa.selenium.Platform;
Expand All @@ -39,12 +41,8 @@ public DesiredCapabilities() {
// no-arg constructor
}

public DesiredCapabilities(Map<String, ?> rawMap) {
if (rawMap == null) {
return;
}

rawMap.forEach(this::setCapability);
public DesiredCapabilities(@Nullable Map<String, ?> rawMap) {
Optional.ofNullable(rawMap).ifPresent(map -> map.forEach(this::setCapability));
}

public DesiredCapabilities(Capabilities other) {
Expand Down Expand Up @@ -94,10 +92,9 @@ public void setAcceptInsecureCerts(boolean acceptInsecureCerts) {
* @return DesiredCapabilities after the merge
*/
@Override
public DesiredCapabilities merge(Capabilities extraCapabilities) {
if (extraCapabilities != null) {
extraCapabilities.asMap().forEach(this::setCapability);
}
public DesiredCapabilities merge(@Nullable Capabilities extraCapabilities) {
Optional.ofNullable(extraCapabilities)
.ifPresent(caps -> caps.asMap().forEach(this::setCapability));
return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import java.util.concurrent.TimeoutException;
import java.util.concurrent.locks.ReentrantLock;
import java.util.logging.Logger;
import org.jspecify.annotations.Nullable;
import org.openqa.selenium.Beta;
import org.openqa.selenium.Capabilities;
import org.openqa.selenium.ImmutableCapabilities;
Expand Down Expand Up @@ -145,15 +146,15 @@ protected Capabilities getDefaultDriverOptions() {
return new ImmutableCapabilities();
}

protected String getDriverName() {
protected @Nullable String getDriverName() {
return null;
}

public String getDriverProperty() {
public @Nullable String getDriverProperty() {
return null;
}

protected File getDriverExecutable() {
protected @Nullable File getDriverExecutable() {
return null;
}

Expand Down