-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[java] Add JSpecify annotations to Color class (Issue #14291) #16626
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 Color class (Issue #14291) #16626
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 |
||||||||||||||||||||||||
|
Thank you, @spencerarq for this code suggestion. The support packages contain example code that many users find helpful, but they do not necessarily represent After reviewing the change, unless it is a critical fix or a feature that is needed for Selenium We actively encourage people to add the wrapper and helper code that makes sense for them to their own frameworks. |
PR Code Suggestions ✨No code suggestions found for the PR. |
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.support.Colorclass, as part of the effort to improve null-safety across the codebase.🔧 Implementation Notes
1. Annotation: The
Colorclass was annotated with@NullMarked(defaulting parameters and return types to non-null).2. Build Fix: The infrastructure required an update. I added
org.jspecify:jspecifydependency to thesupport-libtarget inBUILD.bazelto resolve the indirect dependency error from Bazel's strict policy.3. Motivation: This provides better static analysis support and improves Kotlin interoperability by making nullability contracts explicit for developers using the Java bindings.
💡 Additional Considerations
Verification: All related tests were executed successfully using Bazel:
bazel test //java/test/org/openqa/selenium/support:ColorTestThe build completed successfully and 1 test passed.
🔄 Types of changes
PR Type
Enhancement, Documentation
Description
Add JSpecify
@NullMarkedand@Nullableannotations to Color classImprove null-safety and Kotlin interoperability with explicit nullability contracts
Add
org.jspecify:jspecifydependency to support-lib BUILD targetMark
Converter.getColor()method return type as nullableDiagram Walkthrough
File Walkthrough
Color.java
Add JSpecify null-safety annotations to Color classjava/src/org/openqa/selenium/support/Color.java
@NullMarkedclass-level annotation to default parameters andreturn types to non-null
@Nullableannotation toConverter.getColor()method return typeNullMarkedandNullable)BUILD.bazel
Add JSpecify dependency to BUILD configurationjava/src/org/openqa/selenium/support/BUILD.bazel
org.jspecify:jspecifyartifact dependency to support-libjava_export target
policy