Skip to content

Conversation

@mk868
Copy link
Contributor

@mk868 mk868 commented Dec 27, 2025

User description

🔗 Related Issues

Related #14291

💥 What does this PR do?

JSpecify annotations added to the:

  • org.openqa.selenium.support.ui.SlowLoadableComponent
  • org.openqa.selenium.support.ui.LoadableComponent

🔧 Implementation Notes

💡 Additional Considerations

I know that the future of the support package is still unknown/undecided.
But there is an user-facing API, so it would be nice to have nullability annotations there.
Especially for running a NullAway analysis for the whole project.

🔄 Types of changes

  • New feature (non-breaking change which adds functionality and tests!)

PR Type

Enhancement


Description

  • Add JSpecify @NullMarked annotations to LoadableComponent

  • Add JSpecify @NullMarked annotations to SlowLoadableComponent

  • Add jspecify dependency to BUILD.bazel configuration


Diagram Walkthrough

flowchart LR
  A["LoadableComponent.java"] -->|"add @NullMarked"| B["Nullability annotated"]
  C["SlowLoadableComponent.java"] -->|"add @NullMarked"| B
  D["BUILD.bazel"] -->|"add jspecify dependency"| B
Loading

File Walkthrough

Relevant files
Enhancement
LoadableComponent.java
Add JSpecify nullability annotation to LoadableComponent 

java/src/org/openqa/selenium/support/ui/LoadableComponent.java

  • Import org.jspecify.annotations.NullMarked
  • Add @NullMarked annotation to class declaration
  • Enables nullability checking for the LoadableComponent class
+3/-0     
SlowLoadableComponent.java
Add JSpecify nullability annotation to SlowLoadableComponent

java/src/org/openqa/selenium/support/ui/SlowLoadableComponent.java

  • Import org.jspecify.annotations.NullMarked
  • Add @NullMarked annotation to class declaration
  • Enables nullability checking for the SlowLoadableComponent class
+2/-0     
Dependencies
BUILD.bazel
Add jspecify dependency to BUILD configuration                     

java/src/org/openqa/selenium/support/ui/BUILD.bazel

  • Add org.jspecify:jspecify artifact dependency to components target
  • Enables JSpecify annotation support for LoadableComponent and
    SlowLoadableComponent
+3/-0     

@selenium-ci selenium-ci added C-java Java Bindings B-build Includes scripting, bazel and CI integrations B-support Issue or PR related to support classes labels Dec 27, 2025
@qodo-code-review
Copy link
Contributor

PR Compliance Guide 🔍

Below is a summary of compliance checks for this PR:

Security Compliance
🟢
No security concerns identified No security vulnerabilities detected by AI analysis. Human verification advised for critical code.
Ticket Compliance
🟡
🎫 #14291
🟢 Introduce JSpecify nullness annotations in Selenium’s Java codebase so IDEs and static
analyzers can understand nullability beyond JavaDoc.
Improve Kotlin interoperability by expressing nullability via JSpecify annotations.
Codebase Duplication Compliance
Codebase context is not defined

Follow the guide to enable codebase context checks.

Custom Compliance
🟢
Generic: Comprehensive Audit Trails

Objective: To create a detailed and reliable record of critical system actions for security analysis
and compliance.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Meaningful Naming and Self-Documenting Code

Objective: Ensure all identifiers clearly express their purpose and intent, making code
self-documenting

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Robust Error Handling and Edge Case Management

Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Error Handling

Objective: To prevent the leakage of sensitive system information through error messages while
providing sufficient detail for internal debugging.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Logging Practices

Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
information like PII, PHI, or cardholder data.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Security-First Input Validation and Data Handling

Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
vulnerabilities

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Compliance status legend 🟢 - Fully Compliant
🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label

@selenium-ci
Copy link
Member

Thank you, @mk868 for this code suggestion.

The support packages contain example code that many users find helpful, but they do not necessarily represent
the best practices for using Selenium, and the Selenium team is not currently merging changes to them.

After reviewing the change, unless it is a critical fix or a feature that is needed for Selenium
to work, we will likely close the PR.

We actively encourage people to add the wrapper and helper code that makes sense for them to their own frameworks.
If you have any questions, please contact us

@qodo-code-review
Copy link
Contributor

PR Code Suggestions ✨

No code suggestions found for the PR.


package org.openqa.selenium.support.ui;

import org.jspecify.annotations.NullMarked;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mk868 please add Nullmarked annotation and import to package-info.java on ui package level

import java.time.Clock;
import java.time.Duration;
import java.time.Instant;
import org.jspecify.annotations.NullMarked;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a reminder to remove import here after you add package-info.java to ui package

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

B-build Includes scripting, bazel and CI integrations B-support Issue or PR related to support classes C-java Java Bindings Review effort 2/5

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants