-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[java] JSpecify annotations for capabilities #14397
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
Conversation
PR Reviewer Guide 🔍
|
PR Code Suggestions ✨
|
I pushed one more commit to fix two more NullAway errors (related: #14421).
Actually, in multithreaded applications @diemol could you look at this? |
Can you elaborate? |
Oh, I meant to ask for a review, |
User description
Description
In this PR I'm adding nullness annotations for interfaces and classes:
Capabilities
HasCapabilities
ImmutableCapabilities
MutableCapabilities
PersistentCapabilities
Capabilities
getPlatformName()
- can return null value -> marked with@Nullable
getCapability(String capabilityName)
- can return null value when capability with specified name does not exist -> marked with@Nullable
HasCapabilities
No null values
ImmutableCapabilities
getCapability(String capabilityName)
- follows fromCapabilities#getCapability(String capabilityName)
-> marked with@Nullable
equals(Object o)
- null parameter allowed -> marked with@Nullable
MutableCapabilities
setCapability(String key, Object value)
- nullvalue
allowed (then capability with specified key will be removed) -> marked with@Nullable
getCapability(String capabilityName)
- follows fromCapabilities#getCapability(String capabilityName)
-> marked with@Nullable
equals(Object o)
- null parameter allowed -> marked with@Nullable
PersistentCapabilities
getCapability(String capabilityName)
- follows fromCapabilities#getCapability(String capabilityName)
-> marked with@Nullable
equals(Object o)
- null parameter allowed -> marked with@Nullable
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
and@Nullable
) to several interfaces and classes to improve null safety.Capabilities
,HasCapabilities
,ImmutableCapabilities
,MutableCapabilities
, andPersistentCapabilities
to include these annotations.NullPointerExceptions
.Changes walkthrough 📝
Capabilities.java
Add nullness annotations to Capabilities interface
java/src/org/openqa/selenium/Capabilities.java
@NullMarked
annotation to the interface.getPlatformName
andgetCapability
methods with@Nullable
.HasCapabilities.java
Add nullness annotations to HasCapabilities interface
java/src/org/openqa/selenium/HasCapabilities.java
@NullMarked
annotation to the interface.ImmutableCapabilities.java
Add nullness annotations to ImmutableCapabilities class
java/src/org/openqa/selenium/ImmutableCapabilities.java
@NullMarked
annotation to the class.getCapability
andequals
methods with@Nullable
.MutableCapabilities.java
Add nullness annotations to MutableCapabilities class
java/src/org/openqa/selenium/MutableCapabilities.java
@NullMarked
annotation to the class.setCapability
,getCapability
, andequals
methods with@Nullable
.PersistentCapabilities.java
Add nullness annotations to PersistentCapabilities class
java/src/org/openqa/selenium/PersistentCapabilities.java
@NullMarked
annotation to the class.getCapability
andequals
methods with@Nullable
.