Skip to content

Commit

Permalink
Merge branch 'trunk' into nullaway
Browse files Browse the repository at this point in the history
  • Loading branch information
diemol authored Dec 28, 2024
2 parents 2d4d6fa + b60fb8e commit 6113108
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 4 deletions.
5 changes: 4 additions & 1 deletion java/src/org/openqa/selenium/Dimension.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;

/** Similar to Point - implement locally to avoid depending on GWT. */
@NullMarked
public class Dimension {
public final int width;
public final int height;
Expand All @@ -38,7 +41,7 @@ public int getHeight() {
}

@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (!(o instanceof Dimension)) {
return false;
}
Expand Down
5 changes: 4 additions & 1 deletion java/src/org/openqa/selenium/Keys.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
package org.openqa.selenium;

import java.util.Arrays;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;

/**
* Representations of pressable keys that aren't text. These are stored in the Unicode PUA (Private
Expand All @@ -26,6 +28,7 @@
* @see <a
* href="http://www.google.com.au/search?&amp;q=unicode+pua&amp;btnK=Search">http://www.google.com.au/search?&amp;q=unicode+pua&amp;btnK=Search</a>
*/
@NullMarked
public enum Keys implements CharSequence {
NULL('\uE000'),
CANCEL('\uE001'), // ^break
Expand Down Expand Up @@ -180,7 +183,7 @@ public static String chord(Iterable<CharSequence> value) {
* @param key unicode character code
* @return special key linked to the character code, or null if character is not a special key
*/
public static Keys getKeyFromUnicode(char key) {
public static @Nullable Keys getKeyFromUnicode(char key) {
for (Keys unicodeKey : values()) {
if (unicodeKey.charAt(0) == key) {
return unicodeKey;
Expand Down
5 changes: 4 additions & 1 deletion java/src/org/openqa/selenium/Point.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;

/** A copy of java.awt.Point, to remove dependency on awt. */
@NullMarked
public class Point {
public int x;
public int y;
Expand All @@ -42,7 +45,7 @@ public Point moveBy(int xOffset, int yOffset) {
}

@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (!(o instanceof Point)) {
return false;
}
Expand Down
5 changes: 4 additions & 1 deletion java/src/org/openqa/selenium/Rectangle.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@

import java.util.Map;
import java.util.Objects;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;

@NullMarked
public class Rectangle {

public final int x;
Expand Down Expand Up @@ -70,7 +73,7 @@ private Map<String, Object> toJson() {
}

@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}
Expand Down
2 changes: 2 additions & 0 deletions java/src/org/openqa/selenium/UsernameAndPassword.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@
package org.openqa.selenium;

import java.util.function.Supplier;
import org.jspecify.annotations.NullMarked;
import org.openqa.selenium.internal.Require;

/** A combination of username and password to use when authenticating a browser with a website. */
@NullMarked
public class UsernameAndPassword implements Credentials {

private final String username;
Expand Down

0 comments on commit 6113108

Please sign in to comment.