Skip to content

[java] added jspecify annotations Nullable and NullMarked to exception classes #16024

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Open
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
8 changes: 6 additions & 2 deletions java/src/org/openqa/selenium/DetachedShadowRootException.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,20 @@

package org.openqa.selenium;

import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;

/**
* Indicates that a reference to a shadow root is now "detached" --- the element no longer appears
* on the DOM of the page.
*/
@NullMarked
public class DetachedShadowRootException extends WebDriverException {
public DetachedShadowRootException(String message) {
public DetachedShadowRootException(@Nullable String message) {
super(message);
}

public DetachedShadowRootException(String message, Throwable cause) {
public DetachedShadowRootException(@Nullable String message, @Nullable Throwable cause) {
super(message, cause);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,21 @@

package org.openqa.selenium;

import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;

/**
* Indicates that a click could not be properly executed because the target element was obscured in
* some way.
*/
@NullMarked
public class ElementClickInterceptedException extends ElementNotInteractableException {

public ElementClickInterceptedException(String message) {
public ElementClickInterceptedException(@Nullable String message) {
super(message);
}

public ElementClickInterceptedException(String message, Throwable cause) {
public ElementClickInterceptedException(@Nullable String message, @Nullable Throwable cause) {
super(message, cause);
}
}
4 changes: 3 additions & 1 deletion java/src/org/openqa/selenium/HealthCheckFailedException.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@

package org.openqa.selenium;

import org.jspecify.annotations.Nullable;

/** Indicates that a Node health check failed. */
public class HealthCheckFailedException extends WebDriverException {

public HealthCheckFailedException(String msg, Throwable cause) {
public HealthCheckFailedException(@Nullable String msg, @Nullable Throwable cause) {
super(msg, cause);
}
}
10 changes: 7 additions & 3 deletions java/src/org/openqa/selenium/InsecureCertificateException.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,24 @@

package org.openqa.selenium;

import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;

/**
* Indicates that navigation caused by the user agent hit a certificate warning, which is usually
* the result of an expired or invalid TLS certificate.
*/
@NullMarked
public class InsecureCertificateException extends WebDriverException {
public InsecureCertificateException(String message) {
public InsecureCertificateException(@Nullable String message) {
super(message);
}

public InsecureCertificateException(Throwable cause) {
public InsecureCertificateException(@Nullable Throwable cause) {
super(cause);
}

public InsecureCertificateException(String message, Throwable cause) {
public InsecureCertificateException(@Nullable String message, @Nullable Throwable cause) {
super(message, cause);
}
}
8 changes: 6 additions & 2 deletions java/src/org/openqa/selenium/InvalidArgumentException.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,16 @@

package org.openqa.selenium;

import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;

@NullMarked
public class InvalidArgumentException extends WebDriverException {
public InvalidArgumentException(String message) {
public InvalidArgumentException(@Nullable String message) {
super(message);
}

public InvalidArgumentException(String message, Throwable cause) {
public InvalidArgumentException(@Nullable String message, @Nullable Throwable cause) {
super(message, cause);
}
}
10 changes: 7 additions & 3 deletions java/src/org/openqa/selenium/InvalidElementStateException.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,28 @@

package org.openqa.selenium;

import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;

/**
* Indicates that a {@link WebElement} is in a state that means actions cannot be performed with it.
* For example, attempting to clear an element that isn’t both editable and resettable.
*/
@NullMarked
public class InvalidElementStateException extends WebDriverException {
public InvalidElementStateException() {
super();
}

public InvalidElementStateException(String message) {
public InvalidElementStateException(@Nullable String message) {
super(message);
}

public InvalidElementStateException(Throwable cause) {
public InvalidElementStateException(@Nullable Throwable cause) {
super(cause);
}

public InvalidElementStateException(String message, Throwable cause) {
public InvalidElementStateException(@Nullable String message, @Nullable Throwable cause) {
super(message, cause);
}
}
10 changes: 7 additions & 3 deletions java/src/org/openqa/selenium/UnsupportedCommandException.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,26 @@

package org.openqa.selenium;

import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;

/** Used to indicate that a command used by the remote webdriver is unsupported. */
@NullMarked
public class UnsupportedCommandException extends WebDriverException {

public UnsupportedCommandException() {
super();
}

public UnsupportedCommandException(String message) {
public UnsupportedCommandException(@Nullable String message) {
super(message);
}

public UnsupportedCommandException(Throwable cause) {
public UnsupportedCommandException(@Nullable Throwable cause) {
super(cause);
}

public UnsupportedCommandException(String message, Throwable cause) {
public UnsupportedCommandException(@Nullable String message, @Nullable Throwable cause) {
super(message, cause);
}
}