From 53a89e3e0f49e5457df7ed4ad4486b85bf78f12e Mon Sep 17 00:00:00 2001 From: Maciej Kucharczyk Date: Mon, 20 Jan 2025 17:23:52 +0100 Subject: [PATCH 1/2] [java] Add nullness for interactions --- java/src/org/openqa/selenium/interactions/Coordinates.java | 2 ++ java/src/org/openqa/selenium/interactions/Interactive.java | 2 ++ java/src/org/openqa/selenium/interactions/SourceType.java | 5 ++++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/java/src/org/openqa/selenium/interactions/Coordinates.java b/java/src/org/openqa/selenium/interactions/Coordinates.java index dc6780d98efa7..e723cd60a28e1 100644 --- a/java/src/org/openqa/selenium/interactions/Coordinates.java +++ b/java/src/org/openqa/selenium/interactions/Coordinates.java @@ -17,12 +17,14 @@ package org.openqa.selenium.interactions; +import org.jspecify.annotations.NullMarked; import org.openqa.selenium.Point; /** * Provides coordinates of an element for advanced interactions. Note that some coordinates (such as * screen coordinates) are evaluated lazily since the element may have to be scrolled into view. */ +@NullMarked public interface Coordinates { /** diff --git a/java/src/org/openqa/selenium/interactions/Interactive.java b/java/src/org/openqa/selenium/interactions/Interactive.java index c47e0fc1ab4d0..df6b39feee4f9 100644 --- a/java/src/org/openqa/selenium/interactions/Interactive.java +++ b/java/src/org/openqa/selenium/interactions/Interactive.java @@ -18,11 +18,13 @@ package org.openqa.selenium.interactions; import java.util.Collection; +import org.jspecify.annotations.NullMarked; /** * Indicates that a class can be used with the W3C WebDriver Actions commands. */ +@NullMarked public interface Interactive { void perform(Collection actions); diff --git a/java/src/org/openqa/selenium/interactions/SourceType.java b/java/src/org/openqa/selenium/interactions/SourceType.java index 973c732797511..230d3fa270f62 100644 --- a/java/src/org/openqa/selenium/interactions/SourceType.java +++ b/java/src/org/openqa/selenium/interactions/SourceType.java @@ -17,10 +17,13 @@ package org.openqa.selenium.interactions; +import org.jspecify.annotations.NullMarked; + /** One of the allowing types for an {@link InputSource}. */ +@NullMarked public enum SourceType { KEY("key"), - NONE(null), + NONE("none"), POINTER("pointer"), WHEEL("wheel"); From 7347d0a1e1c3838459835c904cacec3c6ec9e0b6 Mon Sep 17 00:00:00 2001 From: Maciej Kucharczyk Date: Tue, 25 Mar 2025 19:00:06 +0100 Subject: [PATCH 2/2] Rollback SourceType#NONE --- .../src/org/openqa/selenium/interactions/SourceType.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/java/src/org/openqa/selenium/interactions/SourceType.java b/java/src/org/openqa/selenium/interactions/SourceType.java index 230d3fa270f62..d69d12db1d42c 100644 --- a/java/src/org/openqa/selenium/interactions/SourceType.java +++ b/java/src/org/openqa/selenium/interactions/SourceType.java @@ -18,22 +18,23 @@ package org.openqa.selenium.interactions; import org.jspecify.annotations.NullMarked; +import org.jspecify.annotations.Nullable; /** One of the allowing types for an {@link InputSource}. */ @NullMarked public enum SourceType { KEY("key"), - NONE("none"), + NONE(null), POINTER("pointer"), WHEEL("wheel"); - private final String type; + private final @Nullable String type; - SourceType(String type) { + SourceType(@Nullable String type) { this.type = type; } - public String getType() { + public @Nullable String getType() { return type; } }