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
5 changes: 4 additions & 1 deletion java/src/org/openqa/selenium/ScriptKey.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@
package org.openqa.selenium;

import java.util.Objects;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;
import org.openqa.selenium.internal.Require;

@NullMarked
public class ScriptKey {

private final String identifier;
Expand All @@ -33,7 +36,7 @@ public String getIdentifier() {
}

@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (!(o instanceof ScriptKey)) {
return false;
}
Expand Down
11 changes: 7 additions & 4 deletions java/src/org/openqa/selenium/UnpinnedScriptKey.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,16 @@
import java.util.Set;
import java.util.UUID;
import java.util.WeakHashMap;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;

@NullMarked
public class UnpinnedScriptKey extends ScriptKey {

private static final WeakHashMap<JavascriptExecutor, Set<UnpinnedScriptKey>> pinnedScripts =
new WeakHashMap<>();
private final String script;
private String scriptId;
private @Nullable String scriptId;
private final String scriptHandle;

static UnpinnedScriptKey pin(JavascriptExecutor executor, String script) {
Expand Down Expand Up @@ -61,11 +64,11 @@ public UnpinnedScriptKey(String script) {
this.script = script;
}

public void setScriptId(String id) {
public void setScriptId(@Nullable String id) {
this.scriptId = id;
}

public String getScriptId() {
public @Nullable String getScriptId() {
return this.scriptId;
}

Expand All @@ -91,7 +94,7 @@ public String removalScript() {
}

@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}
Expand Down