|
30 | 30 | import java.util.Objects; |
31 | 31 | import java.util.Set; |
32 | 32 | import java.util.function.IntConsumer; |
| 33 | +import org.jspecify.annotations.NullMarked; |
| 34 | +import org.jspecify.annotations.Nullable; |
33 | 35 | import org.openqa.selenium.WebDriver; |
34 | 36 | import org.openqa.selenium.WebElement; |
35 | 37 | import org.openqa.selenium.interactions.PointerInput.Origin; |
|
44 | 46 | * |
45 | 47 | * <p>Call {@link #perform()} at the end of the method chain to actually perform the actions. |
46 | 48 | */ |
| 49 | +@NullMarked |
47 | 50 | public class Actions { |
48 | 51 |
|
49 | 52 | private final WebDriver driver; |
50 | 53 |
|
51 | 54 | // W3C |
52 | 55 | private final Map<InputSource, Sequence> sequences = new HashMap<>(); |
53 | 56 |
|
54 | | - private PointerInput activePointer; |
55 | | - private KeyInput activeKeyboard; |
56 | | - private WheelInput activeWheel; |
| 57 | + private @Nullable PointerInput activePointer; |
| 58 | + private @Nullable KeyInput activeKeyboard; |
| 59 | + private @Nullable WheelInput activeWheel; |
57 | 60 | private Duration actionDuration; |
58 | 61 |
|
59 | 62 | public Actions(WebDriver driver) { |
@@ -537,21 +540,21 @@ public KeyInput getActiveKeyboard() { |
537 | 540 | if (this.activeKeyboard == null) { |
538 | 541 | setActiveKeyboard("default keyboard"); |
539 | 542 | } |
540 | | - return this.activeKeyboard; |
| 543 | + return Require.nonNull("ActiveKeyboard", this.activeKeyboard); |
541 | 544 | } |
542 | 545 |
|
543 | 546 | public PointerInput getActivePointer() { |
544 | 547 | if (this.activePointer == null) { |
545 | 548 | setActivePointer(PointerInput.Kind.MOUSE, "default mouse"); |
546 | 549 | } |
547 | | - return this.activePointer; |
| 550 | + return Require.nonNull("ActivePointer", this.activePointer); |
548 | 551 | } |
549 | 552 |
|
550 | 553 | public WheelInput getActiveWheel() { |
551 | 554 | if (this.activeWheel == null) { |
552 | 555 | setActiveWheel("default wheel"); |
553 | 556 | } |
554 | | - return this.activeWheel; |
| 557 | + return Require.nonNull("ActiveWheel", this.activeWheel); |
555 | 558 | } |
556 | 559 |
|
557 | 560 | public Duration getActionDuration() { |
|
0 commit comments