[java] Add @Nullable annotations to Firefox and Gecko driver service #15999
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
partially fixes #14291
💥 What does this PR do?
🔧 Implementation Notes
This pull request introduces changes to improve null safety in the Selenium Firefox and Gecko driver services by integrating
@Nullableannotations. It also includes a dependency update in the Bazel build file to support these annotations.Null Safety Enhancements:
java/src/org/openqa/selenium/firefox/FirefoxDriverService.java: Added@Nullableannotations to parameters in the constructor (File executable,Duration timeout,List<String> args,Map<String, String> environment) to indicate they can accept null values.java/src/org/openqa/selenium/firefox/GeckoDriverService.java: Added@Nullableannotations to parameters in the constructor and various methods (File executable,Duration timeout,List<String> args,Map<String, String> environment,String allowHosts,FirefoxDriverLogLevel logLevel,Boolean logTruncate,File profileRoot). [1] [2] [3] [4] [5] [6] [7]Dependency Update:
java/src/org/openqa/selenium/firefox/BUILD.bazel: Added a new dependency,@maven//:org_jspecify_jspecify, to support@Nullableannotations.These changes improve code clarity and safety by explicitly marking nullable parameters, reducing potential null-pointer exceptions during runtime.
💡 Additional Considerations
🔄 Types of changes
PR Type
Enhancement
Description
Add @nullable annotations to Firefox and Gecko driver service constructors
Enhance null safety for driver service parameters
Update Bazel build dependencies for JSpecify annotations
Changes diagram
Changes walkthrough 📝
FirefoxDriverService.java
Add null safety annotations to constructorjava/src/org/openqa/selenium/firefox/FirefoxDriverService.java
environment)
GeckoDriverService.java
Comprehensive null safety annotation coveragejava/src/org/openqa/selenium/firefox/GeckoDriverService.java
BUILD.bazel
Add JSpecify build dependencyjava/src/org/openqa/selenium/firefox/BUILD.bazel