[java] Add JSpecify annotations to ChromiumDriver (Issue #14291)#16628
[java] Add JSpecify annotations to ChromiumDriver (Issue #14291)#16628asolntsev merged 4 commits intoSeleniumHQ:trunkfrom
Conversation
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||||
|
Thanks for the suggestions! I've reviewed them and pushed an update:
I've verified locally (WSL2) that the target |
|
@spencerarq Please run formatter script, see https://github.com/SeleniumHQ/selenium/actions/runs/19939578890/job/57189367948?pr=16628 |
Head branch was pushed to by a user without write access
b2a72dc to
ccd3e19
Compare
|
@asolntsev I've applied the code formatting using the script as requested. |
User description
🔗 Related Issues
Fixes: #14291
(This PR addresses the ongoing effort to adopt JSpecify annotations for null-safety.)
💥 What does this PR do?
This PR adds JSpecify annotations to the
org.openqa.selenium.chromium.ChromiumDriverclass, contributing to the improved null-safety of the Java core codebase.🔧 Implementation Notes
1. Annotation: The
ChromiumDriverclass was annotated with@NullMarked(enforcing non-null defaults for parameters and return types).2. Build Fix: The infrastructure required an update. I added
org.jspecify:jspecifydependency to thechromiumtarget inBUILD.bazelto resolve compilation dependencies.3. Motivation: This provides better static analysis accuracy and improves Developer Experience (DX) by making explicit nullability contracts for the Chromium-based driver.
💡 Additional Considerations
Verification: The module was built successfully using Bazel to ensure dependency resolution and compilation:
bazel build //java/src/org/openqa/selenium/chromium:chromiumThe build completed successfully.
🔄 Types of changes
PR Type
Enhancement
Description
Add JSpecify
@NullMarkedannotation to ChromiumDriver classMark nullable fields
castingandcdpwith@NullableAdd
org.jspecify:jspecifydependency to BUILD.bazelDiagram Walkthrough
File Walkthrough
ChromiumDriver.java
Add JSpecify null-safety annotationsjava/src/org/openqa/selenium/chromium/ChromiumDriver.java
@NullMarkedand@Nullable)@NullMarkedclass-level annotation for null-safety enforcementcastingandcdpfields with@Nullableto indicate they canbe null
BUILD.bazel
Add JSpecify dependency to build configurationjava/src/org/openqa/selenium/chromium/BUILD.bazel
org.jspecify:jspecifyartifact dependencyartifactandjava_libraryfunctions