Skip to content

Commit 98754f5

Browse files
committed
[java] JSpecify annotations for CommandCodec
1 parent 7ac21b9 commit 98754f5

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

java/src/org/openqa/selenium/remote/CommandCodec.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
package org.openqa.selenium.remote;
1919

20+
import org.jspecify.annotations.NullMarked;
2021
import org.openqa.selenium.UnsupportedCommandException;
2122
import org.openqa.selenium.remote.http.HttpMethod;
2223

@@ -25,6 +26,7 @@
2526
*
2627
* @param <T> The type of encoded command.
2728
*/
29+
@NullMarked
2830
public interface CommandCodec<T> {
2931

3032
/**

java/src/org/openqa/selenium/remote/codec/AbstractHttpCommandCodec.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@
9090
import java.util.Objects;
9191
import java.util.concurrent.ConcurrentHashMap;
9292
import java.util.stream.Collectors;
93+
import org.jspecify.annotations.NullMarked;
94+
import org.jspecify.annotations.Nullable;
9395
import org.openqa.selenium.UnsupportedCommandException;
9496
import org.openqa.selenium.internal.Require;
9597
import org.openqa.selenium.json.Json;
@@ -106,6 +108,7 @@
106108
*
107109
* @see <a href="https://w3.org/tr/webdriver">W3C WebDriver spec</a>
108110
*/
111+
@NullMarked
109112
public abstract class AbstractHttpCommandCodec implements CommandCodec<HttpRequest> {
110113
private static final String SESSION_ID_PARAM = "sessionId";
111114

@@ -362,7 +365,7 @@ private CommandSpec(HttpMethod method, String path) {
362365
}
363366

364367
@Override
365-
public boolean equals(Object o) {
368+
public boolean equals(@Nullable Object o) {
366369
if (o instanceof CommandSpec) {
367370
CommandSpec that = (CommandSpec) o;
368371
return this.method.equals(that.method) && this.path.equals(that.path);

java/src/org/openqa/selenium/remote/codec/w3c/W3CHttpCommandCodec.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@
8686
import java.util.regex.Pattern;
8787
import java.util.stream.Collectors;
8888
import java.util.stream.Stream;
89+
import org.jspecify.annotations.NullMarked;
8990
import org.openqa.selenium.InvalidSelectorException;
9091
import org.openqa.selenium.WebDriverException;
9192
import org.openqa.selenium.remote.WebElementToJsonConverter;
@@ -96,6 +97,7 @@
9697
*
9798
* @see <a href="https://w3.org/tr/webdriver">W3C WebDriver spec</a>
9899
*/
100+
@NullMarked
99101
public class W3CHttpCommandCodec extends AbstractHttpCommandCodec {
100102

101103
private static final ConcurrentHashMap<String, String> ATOM_SCRIPTS = new ConcurrentHashMap<>();

0 commit comments

Comments
 (0)