-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[java] Add JSpecify nullable annotations to exception classes pt2 #16025
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
base: trunk
Are you sure you want to change the base?
[java] Add JSpecify nullable annotations to exception classes pt2 #16025
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! @iampopovich
…ption-classes-pt2
…ption-classes-pt2
User description
🔗 Related Issues
partially fixes #14291
💥 What does this PR do?
same as #16024
🔧 Implementation Notes
This pull request introduces nullability annotations to improve type safety and clarify the handling of nullable values in several exception classes within the Selenium Java codebase. The changes ensure that parameters and fields that can accept or return
null
are explicitly marked as nullable, while the classes themselves are marked as null-safe.Nullability Annotations Added to Exception Classes:
NoSuchSessionException
:@NullMarked
annotation to the class.reason
parameter in constructors as@Nullable
.ScriptTimeoutException
:@NullMarked
annotation to the class.message
andcause
parameters in constructors as@Nullable
.SessionNotCreatedException
:@NullMarked
annotation to the class.msg
andcause
parameters in constructors as@Nullable
.TimeoutException
:@NullMarked
annotation to the class.message
andcause
parameters in constructors as@Nullable
.UnhandledAlertException
:@NullMarked
annotation to the class.alertText
field and themessage
andalertText
parameters in constructors as@Nullable
.getAlertText
method to return@Nullable
.💡 Additional Considerations
🔄 Types of changes
PR Type
Enhancement
Description
Added JSpecify nullability annotations to exception classes
Marked classes as
@NullMarked
for null safetyAnnotated constructor parameters and fields as
@Nullable
Enhanced type safety for exception handling
Changes diagram
Changes walkthrough 📝
NoSuchSessionException.java
Added nullability annotations to NoSuchSessionException
java/src/org/openqa/selenium/NoSuchSessionException.java
@NullMarked
class annotationreason
constructor parameters as@Nullable
ScriptTimeoutException.java
Added nullability annotations to ScriptTimeoutException
java/src/org/openqa/selenium/ScriptTimeoutException.java
@NullMarked
class annotationmessage
andcause
constructor parameters as@Nullable
SessionNotCreatedException.java
Added nullability annotations to SessionNotCreatedException
java/src/org/openqa/selenium/SessionNotCreatedException.java
@NullMarked
class annotationmsg
andcause
constructor parameters as@Nullable
TimeoutException.java
Added nullability annotations to TimeoutException
java/src/org/openqa/selenium/TimeoutException.java
@NullMarked
class annotationmessage
andcause
constructor parameters as@Nullable
UnhandledAlertException.java
Added nullability annotations to UnhandledAlertException
java/src/org/openqa/selenium/UnhandledAlertException.java
@NullMarked
class annotationalertText
field and constructor parameters as@Nullable
getAlertText
method return type as@Nullable