-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[java] JSpecify annotations for immutable models and enums #14395
Conversation
PR Reviewer Guide 🔍
|
PR 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, @mk868!
User description
Description
In this PR I'm adding nullness annotations for classes
Dimension
Keys
Point
Rectangle
UsernameAndPassword
Dimension
equals
accepts null argument -> marked with@Nullable
Keys
getKeyFromUnicode
can return null value -> return type marked with@Nullable
Point
equals
accepts null argument -> marked with@Nullable
Rectangle
equals
accepts null argument -> marked with@Nullable
UsernameAndPassword
No null values
Motivation and Context
The JSpecify nullness annotations will give developers better exposure to potential problems with their code to avoid NullPointerExceptions.
Related issue: #14291
Types of changes
Checklist
PR Type
enhancement
Description
@NullMarked
annotations to several classes and enums to improve nullness handling.equals
methods inDimension
,Point
, andRectangle
classes to accept@Nullable
parameters.getKeyFromUnicode
method inKeys
enum to return@Nullable
.NullPointerExceptions
.Changes walkthrough 📝
Dimension.java
Add nullness annotations to Dimension class
java/src/org/openqa/selenium/Dimension.java
@NullMarked
annotation to theDimension
class.equals
method to accept@Nullable
parameter.Keys.java
Add nullness annotations to Keys enum
java/src/org/openqa/selenium/Keys.java
@NullMarked
annotation to theKeys
enum.getKeyFromUnicode
method to return@Nullable
.Point.java
Add nullness annotations to Point class
java/src/org/openqa/selenium/Point.java
@NullMarked
annotation to thePoint
class.equals
method to accept@Nullable
parameter.Rectangle.java
Add nullness annotations to Rectangle class
java/src/org/openqa/selenium/Rectangle.java
@NullMarked
annotation to theRectangle
class.equals
method to accept@Nullable
parameter.UsernameAndPassword.java
Add nullness annotations to UsernameAndPassword class
java/src/org/openqa/selenium/UsernameAndPassword.java
@NullMarked
annotation to theUsernameAndPassword
class.