Skip to content

Commit 0e0c56c

Browse files
authored
Merge branch 'trunk' into java-websocket-port-bidi
2 parents c27cfac + a9348cf commit 0e0c56c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1713
-2748
lines changed

.mailmap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Brandon Walderman <[email protected]> <[email protected]>
1616
1717
1818
19-
19+
Corey Goldberg <[email protected].com> <cgoldberg@gmail.com>
2020
2121
2222
Daniel P. Purkhús <[email protected]>

MODULE.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ bazel_dep(name = "rules_multitool", version = "1.3.0")
2424
bazel_dep(name = "rules_nodejs", version = "6.3.2")
2525
bazel_dep(name = "rules_oci", version = "1.8.0")
2626
bazel_dep(name = "rules_pkg", version = "1.0.1")
27-
bazel_dep(name = "rules_python", version = "1.1.0")
27+
bazel_dep(name = "rules_python", version = "1.5.0")
2828
bazel_dep(name = "rules_proto", version = "7.0.2")
2929
bazel_dep(name = "rules_ruby", version = "0.19.0")
3030

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ you can configure it use Bazel artifacts:
266266
1. Open `rb/` as a main project directory.
267267
2. Run `bundle exec rake update` as necessary to create up-to-date artifacts. If this does not work, run `./go rb:update` from the `selenium` (parent) directory.
268268
3. In <kbd>Settings / Languages & Frameworks / Ruby SDK and Gems</kbd> add new <kbd>Interpreter</kbd> pointing to `../bazel-selenium/external/rules_ruby_dist/dist/bin/ruby`.
269-
4. You should now be able to run and debug any spec. It uses Chrome by default, but you can alter it using environment variables secified in [Ruby Testing](#ruby-2) section below.
269+
4. You should now be able to run and debug any spec. It uses Chrome by default, but you can alter it using environment variables specified in [Ruby Testing](#ruby-2) section below.
270270

271271
### Rust
272272

java/src/org/openqa/selenium/By.java

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
import java.util.Map;
2424
import java.util.Objects;
2525
import java.util.regex.Pattern;
26+
import org.jspecify.annotations.NullMarked;
27+
import org.jspecify.annotations.Nullable;
2628
import org.openqa.selenium.internal.Require;
2729

2830
/**
@@ -40,6 +42,7 @@
4042
* }
4143
* </code></pre>
4244
*/
45+
@NullMarked
4346
public abstract class By {
4447
/**
4548
* @param id The value of the "id" attribute to search for.
@@ -158,7 +161,7 @@ protected JavascriptExecutor getJavascriptExecutor(SearchContext context) {
158161
}
159162

160163
@Override
161-
public boolean equals(Object o) {
164+
public boolean equals(@Nullable Object o) {
162165
if (!(o instanceof By)) {
163166
return false;
164167
}
@@ -342,9 +345,9 @@ public interface Remotable {
342345

343346
class Parameters {
344347
private final String using;
345-
private final Object value;
348+
private final @Nullable Object value;
346349

347-
public Parameters(String using, Object value) {
350+
public Parameters(String using, @Nullable Object value) {
348351
this.using = Require.nonNull("Search mechanism", using);
349352
// There may be subclasses where the value is optional. Allow for this.
350353
this.value = value;
@@ -354,7 +357,7 @@ public String using() {
354357
return using;
355358
}
356359

357-
public Object value() {
360+
public @Nullable Object value() {
358361
return value;
359362
}
360363

@@ -364,7 +367,7 @@ public String toString() {
364367
}
365368

366369
@Override
367-
public boolean equals(Object o) {
370+
public boolean equals(@Nullable Object o) {
368371
if (!(o instanceof Parameters)) {
369372
return false;
370373
}
@@ -377,8 +380,8 @@ public int hashCode() {
377380
return Objects.hash(using, value);
378381
}
379382

380-
private Map<String, Object> toJson() {
381-
Map<String, Object> params = new HashMap<>();
383+
private Map<String, @Nullable Object> toJson() {
384+
Map<String, @Nullable Object> params = new HashMap<>();
382385
params.put("using", using);
383386
params.put("value", value);
384387
return Collections.unmodifiableMap(params);
@@ -410,7 +413,7 @@ public final Parameters getRemoteParameters() {
410413
return params;
411414
}
412415

413-
protected final Map<String, Object> toJson() {
416+
protected final Map<String, @Nullable Object> toJson() {
414417
return getRemoteParameters().toJson();
415418
}
416419
}
@@ -441,7 +444,7 @@ public final Parameters getRemoteParameters() {
441444
return remoteParams;
442445
}
443446

444-
protected final Map<String, Object> toJson() {
447+
protected final Map<String, @Nullable Object> toJson() {
445448
return fallback.toJson();
446449
}
447450

java/src/org/openqa/selenium/Capabilities.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,18 @@
2424
import java.util.Optional;
2525
import java.util.Set;
2626
import java.util.stream.Stream;
27+
import org.jspecify.annotations.NullMarked;
28+
import org.jspecify.annotations.Nullable;
2729

2830
/** Describes a series of key/value pairs that encapsulate aspects of a browser. */
31+
@NullMarked
2932
public interface Capabilities extends Serializable {
3033

3134
default String getBrowserName() {
3235
return String.valueOf(Optional.ofNullable(getCapability("browserName")).orElse(""));
3336
}
3437

35-
default Platform getPlatformName() {
38+
default @Nullable Platform getPlatformName() {
3639
return Stream.of("platformName")
3740
.map(this::getCapability)
3841
.filter(Objects::nonNull)
@@ -67,7 +70,7 @@ default String getBrowserVersion() {
6770
* @return The value, or null if not set.
6871
* @see org.openqa.selenium.remote.CapabilityType
6972
*/
70-
Object getCapability(String capabilityName);
73+
@Nullable Object getCapability(String capabilityName);
7174

7275
/**
7376
* @param capabilityName The capability to check.

java/src/org/openqa/selenium/HasCapabilities.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,13 @@
1717

1818
package org.openqa.selenium;
1919

20+
import org.jspecify.annotations.NullMarked;
21+
2022
/**
2123
* Used by classes to indicate that they can describe the {@link org.openqa.selenium.Capabilities}
2224
* they possess. This can be used for run-time detection of features.
2325
*/
26+
@NullMarked
2427
public interface HasCapabilities {
2528
/**
2629
* @return The capabilities of the current driver.

java/src/org/openqa/selenium/ImmutableCapabilities.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,11 @@
2222
import java.util.Collections;
2323
import java.util.Map;
2424
import java.util.TreeMap;
25+
import org.jspecify.annotations.NullMarked;
26+
import org.jspecify.annotations.Nullable;
2527
import org.openqa.selenium.internal.Require;
2628

29+
@NullMarked
2730
public class ImmutableCapabilities implements Capabilities {
2831

2932
private final Map<String, Object> delegate;
@@ -145,18 +148,17 @@ public ImmutableCapabilities(Map<?, ?> capabilities) {
145148
capabilities.forEach(
146149
(key, value) -> {
147150
Require.argument("Capability key", key).instanceOf(String.class);
148-
Object v = capabilities.get(key);
149151
Require.nonNull("Capability value", value);
150152

151-
setCapability(delegate, (String) key, v);
153+
setCapability(delegate, (String) key, value);
152154
});
153155

154156
this.delegate = Collections.unmodifiableMap(delegate);
155157
this.hashCode = SharedCapabilitiesMethods.hashCode(this);
156158
}
157159

158160
@Override
159-
public Object getCapability(String capabilityName) {
161+
public @Nullable Object getCapability(String capabilityName) {
160162
Require.nonNull("Capability name", capabilityName);
161163
return delegate.get(capabilityName);
162164
}
@@ -172,7 +174,7 @@ public int hashCode() {
172174
}
173175

174176
@Override
175-
public boolean equals(Object o) {
177+
public boolean equals(@Nullable Object o) {
176178
if (!(o instanceof Capabilities)) {
177179
return false;
178180
}

java/src/org/openqa/selenium/MutableCapabilities.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,11 @@
2222
import java.util.Map;
2323
import java.util.Set;
2424
import java.util.TreeMap;
25+
import org.jspecify.annotations.NullMarked;
26+
import org.jspecify.annotations.Nullable;
2527
import org.openqa.selenium.internal.Require;
2628

29+
@NullMarked
2730
public class MutableCapabilities implements Capabilities {
2831

2932
private static final Set<String> OPTION_KEYS;
@@ -81,7 +84,7 @@ public void setCapability(String capabilityName, Platform value) {
8184
setCapability(capabilityName, (Object) value);
8285
}
8386

84-
public void setCapability(String key, Object value) {
87+
public void setCapability(String key, @Nullable Object value) {
8588
Require.nonNull("Capability name", key);
8689

8790
// We have to special-case some keys and values because of the popular idiom of calling
@@ -107,7 +110,7 @@ public Map<String, Object> asMap() {
107110
}
108111

109112
@Override
110-
public Object getCapability(String capabilityName) {
113+
public @Nullable Object getCapability(String capabilityName) {
111114
return caps.get(capabilityName);
112115
}
113116

@@ -126,7 +129,7 @@ public int hashCode() {
126129
}
127130

128131
@Override
129-
public boolean equals(Object o) {
132+
public boolean equals(@Nullable Object o) {
130133
if (!(o instanceof Capabilities)) {
131134
return false;
132135
}

java/src/org/openqa/selenium/PersistentCapabilities.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,11 @@
2222
import java.util.function.Function;
2323
import java.util.stream.Collectors;
2424
import java.util.stream.Stream;
25+
import org.jspecify.annotations.NullMarked;
26+
import org.jspecify.annotations.Nullable;
2527
import org.openqa.selenium.internal.Require;
2628

29+
@NullMarked
2730
public class PersistentCapabilities implements Capabilities {
2831

2932
private final ImmutableCapabilities caps;
@@ -60,7 +63,7 @@ public Map<String, Object> asMap() {
6063
}
6164

6265
@Override
63-
public Object getCapability(String capabilityName) {
66+
public @Nullable Object getCapability(String capabilityName) {
6467
Require.nonNull("Capability name", capabilityName);
6568
Object capability = overrides.getCapability(capabilityName);
6669
if (capability != null) {
@@ -93,7 +96,7 @@ public int hashCode() {
9396
}
9497

9598
@Override
96-
public boolean equals(Object o) {
99+
public boolean equals(@Nullable Object o) {
97100
if (!(o instanceof Capabilities)) {
98101
return false;
99102
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
load("//java:defs.bzl", "java_export", "java_library")
1+
load("//java:defs.bzl", "artifact", "java_export", "java_library")
22
load("//java:version.bzl", "SE_VERSION")
33

44
java_export(
@@ -57,5 +57,6 @@ java_library(
5757
deps = [
5858
"//java/src/org/openqa/selenium:core",
5959
"//java/src/org/openqa/selenium/support/ui:components",
60+
artifact("org.jspecify:jspecify"),
6061
],
6162
)

0 commit comments

Comments
 (0)