-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[java] Add JSpecify annotations to ChromiumDriver (Issue #14291) #16628
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
base: trunk
Are you sure you want to change the base?
[java] Add JSpecify annotations to ChromiumDriver (Issue #14291) #16628
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 |
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