Skip to content

Conversation

@iampopovich
Copy link
Contributor

@iampopovich iampopovich commented Jul 5, 2025

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 @Nullable annotations. It also includes a dependency update in the Bazel build file to support these annotations.

Null Safety Enhancements:

Dependency Update:

These changes improve code clarity and safety by explicitly marking nullable parameters, reducing potential null-pointer exceptions during runtime.

💡 Additional Considerations

🔄 Types of changes

  • Cleanup (formatting, renaming)

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

flowchart LR
  A["Firefox Driver Services"] --> B["Add @Nullable annotations"]
  B --> C["Constructor parameters"]
  B --> D["Builder methods"]
  E["Bazel BUILD file"] --> F["Add JSpecify dependency"]
Loading

Changes walkthrough 📝

Relevant files
Enhancement
FirefoxDriverService.java
Add null safety annotations to constructor                             

java/src/org/openqa/selenium/firefox/FirefoxDriverService.java

  • Import JSpecify @nullable annotation
  • Add @nullable to constructor parameters (executable, timeout, args,
    environment)
  • +5/-4     
    GeckoDriverService.java
    Comprehensive null safety annotation coverage                       

    java/src/org/openqa/selenium/firefox/GeckoDriverService.java

  • Import JSpecify @nullable annotation
  • Add @nullable to constructor parameters
  • Add @nullable to Builder class fields and methods
  • Update createDriverService method signature with @nullable parameters
  • +18/-13 
    Dependencies
    BUILD.bazel
    Add JSpecify build dependency                                                       

    java/src/org/openqa/selenium/firefox/BUILD.bazel

    • Add JSpecify dependency to support @nullable annotations
    +1/-0     

    Need help?
  • Type /help how to ... in the comments thread for any questions about Qodo Merge usage.
  • Check out the documentation for more information.
  • @selenium-ci selenium-ci added C-java Java Bindings B-build Includes scripting, bazel and CI integrations labels Jul 5, 2025
    @qodo-merge-pro
    Copy link
    Contributor

    qodo-merge-pro bot commented Jul 5, 2025

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Null Handling

    The Builder class fields are now nullable but the methods that use these fields (like createArgs) may need null checks to prevent NullPointerException when accessing nullable fields like allowHosts.split(" ").

      args.add("--allow-hosts");
      args.addAll(Arrays.asList(allowHosts.split(" ")));
    }

    @qodo-merge-pro
    Copy link
    Contributor

    qodo-merge-pro bot commented Jul 5, 2025

    PR Code Suggestions ✨

    No code suggestions found for the PR.

    @iampopovich iampopovich changed the title Add @Nullable annotations to Firefox and Gecko driver service [java] Add @Nullable annotations to Firefox and Gecko driver service Jul 5, 2025
    @diemol diemol merged commit 16971b4 into SeleniumHQ:trunk Jul 7, 2025
    1 check passed
    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 C-java Java Bindings Review effort 2/5

    Projects

    None yet

    Development

    Successfully merging this pull request may close these issues.

    [🚀 Feature]: JSpecify Nullness annotations for Java

    3 participants