diff --git a/java/src/org/openqa/selenium/PageLoadStrategy.java b/java/src/org/openqa/selenium/PageLoadStrategy.java index f9c71d6407841..46d4a416eb8e9 100644 --- a/java/src/org/openqa/selenium/PageLoadStrategy.java +++ b/java/src/org/openqa/selenium/PageLoadStrategy.java @@ -17,6 +17,10 @@ package org.openqa.selenium; +import org.jspecify.annotations.NullMarked; +import org.jspecify.annotations.Nullable; + +@NullMarked public enum PageLoadStrategy { NONE("none"), EAGER("eager"), @@ -33,7 +37,7 @@ public String toString() { return String.valueOf(text); } - public static PageLoadStrategy fromString(String text) { + public static @Nullable PageLoadStrategy fromString(@Nullable String text) { if (text != null) { for (PageLoadStrategy b : PageLoadStrategy.values()) { if (text.equalsIgnoreCase(b.text)) { diff --git a/java/src/org/openqa/selenium/UnexpectedAlertBehaviour.java b/java/src/org/openqa/selenium/UnexpectedAlertBehaviour.java index 7d10e8c1e2964..1f044c54c4448 100644 --- a/java/src/org/openqa/selenium/UnexpectedAlertBehaviour.java +++ b/java/src/org/openqa/selenium/UnexpectedAlertBehaviour.java @@ -17,6 +17,10 @@ package org.openqa.selenium; +import org.jspecify.annotations.NullMarked; +import org.jspecify.annotations.Nullable; + +@NullMarked public enum UnexpectedAlertBehaviour { ACCEPT("accept"), DISMISS("dismiss"), @@ -35,7 +39,7 @@ public String toString() { return String.valueOf(text); } - public static UnexpectedAlertBehaviour fromString(String text) { + public static @Nullable UnexpectedAlertBehaviour fromString(@Nullable String text) { if (text != null) { for (UnexpectedAlertBehaviour b : UnexpectedAlertBehaviour.values()) { if (text.equalsIgnoreCase(b.text)) { diff --git a/java/src/org/openqa/selenium/WindowType.java b/java/src/org/openqa/selenium/WindowType.java index afe583225a502..6ba6d97c1ad8a 100644 --- a/java/src/org/openqa/selenium/WindowType.java +++ b/java/src/org/openqa/selenium/WindowType.java @@ -17,7 +17,11 @@ package org.openqa.selenium; +import org.jspecify.annotations.NullMarked; +import org.jspecify.annotations.Nullable; + /** Represents the type of new browser window that may be created. */ +@NullMarked public enum WindowType { WINDOW("window"), TAB("tab"), @@ -34,7 +38,7 @@ public String toString() { return String.valueOf(text); } - public static WindowType fromString(String text) { + public static @Nullable WindowType fromString(@Nullable String text) { if (text != null) { for (WindowType b : WindowType.values()) { if (text.equalsIgnoreCase(b.text)) {