[java] Add JSpecify nullable annotations to SafariDriverService parameters #16000
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
User description
🔗 Related Issues
fixes #14291
💥 What does this PR do?
🔧 Implementation Notes
This pull request introduces changes to the
SafariDriverService
class and its associated Bazel build file to improve nullability handling and enhance type safety using@Nullable
annotations. These changes aim to make the codebase more robust and compatible with tools that rely on nullability annotations.Nullability Enhancements in
SafariDriverService
:@Nullable
annotations to method parameters: Updated multiple constructors and methods, includingcreateDriverService
, to mark parameters likeFile
,Duration
,List<String>
, andMap<String, String>
as nullable, improving clarity and type safety. ([[1]](https://github.com/SeleniumHQ/selenium/pull/16000/files#diff-5ee8455f18e8d287ed7899d66b590a2e6e13197ef14f9a5213e830ff32d0d656L67-R72)
,[[2]](https://github.com/SeleniumHQ/selenium/pull/16000/files#diff-5ee8455f18e8d287ed7899d66b590a2e6e13197ef14f9a5213e830ff32d0d656L172-R177)
)@Nullable
annotations to fields such asdiagnose
and methods likewithLogging
andwithLogFile
to indicate optional values. ([[1]](https://github.com/SeleniumHQ/selenium/pull/16000/files#diff-5ee8455f18e8d287ed7899d66b590a2e6e13197ef14f9a5213e830ff32d0d656L129-R130)
,[[2]](https://github.com/SeleniumHQ/selenium/pull/16000/files#diff-5ee8455f18e8d287ed7899d66b590a2e6e13197ef14f9a5213e830ff32d0d656L142-R149)
)Build File Update:
@maven//:org_jspecify_jspecify
dependency: Updated the Bazel build file to include theorg.jspecify.jspecify
library, enabling the use of@Nullable
annotations in the project. ([java/src/org/openqa/selenium/safari/BUILD.bazelR17](https://github.com/SeleniumHQ/selenium/pull/16000/files#diff-0b0f5cc1965c89ca728657da296b7183ad9abed4555a906b6846798c506130a8R17)
)Import Statement Update:
@Nullable
annotation: Addedorg.jspecify.annotations.Nullable
to the imports inSafariDriverService.java
to support nullability annotations. ([java/src/org/openqa/selenium/safari/SafariDriverService.javaR35](https://github.com/SeleniumHQ/selenium/pull/16000/files#diff-5ee8455f18e8d287ed7899d66b590a2e6e13197ef14f9a5213e830ff32d0d656R35)
)💡 Additional Considerations
🔄 Types of changes
PR Type
Enhancement
Description
Add
@Nullable
annotations to SafariDriverService parametersEnhance type safety with JSpecify nullability annotations
Update Bazel build configuration for JSpecify dependency
Changes diagram
Changes walkthrough 📝
SafariDriverService.java
Add nullable annotations to parameters and fields
java/src/org/openqa/selenium/safari/SafariDriverService.java
@Nullable
annotation from JSpecify@Nullable
to constructor parameters (File, Duration, List, Map)@Nullable
to Builder class fielddiagnose
@Nullable
to Builder methodswithLogging
andwithLogFile
BUILD.bazel
Add JSpecify dependency to build configuration
java/src/org/openqa/selenium/safari/BUILD.bazel