Skip to content

Conversation

mk868
Copy link
Contributor

@mk868 mk868 commented Oct 22, 2025

User description

🔗 Related Issues

Related #14291

💥 What does this PR do?

JSpecify annotations added to the:

  • org.openqa.selenium.remote.CommandCodec
  • org.openqa.selenium.remote.AbstractHttpCommandCodec
  • org.openqa.selenium.remote.W3CHttpCommandCodec

🔧 Implementation Notes

💡 Additional Considerations

🔄 Types of changes

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

PR Type

Enhancement


Description

  • Add JSpecify @NullMarked annotations to CommandCodec interface

  • Add JSpecify @NullMarked annotations to AbstractHttpCommandCodec class

  • Add JSpecify @NullMarked annotations to W3CHttpCommandCodec class

  • Add @nullable annotation to equals() method parameter in CommandSpec


Diagram Walkthrough

flowchart LR
  A["CommandCodec Interface"] -->|@NullMarked| B["Null-safety enabled"]
  C["AbstractHttpCommandCodec"] -->|@NullMarked| B
  D["W3CHttpCommandCodec"] -->|@NullMarked| B
  E["CommandSpec.equals()"] -->|@Nullable param| B
Loading

File Walkthrough

Relevant files
Enhancement
CommandCodec.java
Add JSpecify @NullMarked to CommandCodec interface             

java/src/org/openqa/selenium/remote/CommandCodec.java

  • Added import for org.jspecify.annotations.NullMarked
  • Applied @NullMarked annotation to the CommandCodec interface
+2/-0     
AbstractHttpCommandCodec.java
Add JSpecify annotations to AbstractHttpCommandCodec         

java/src/org/openqa/selenium/remote/codec/AbstractHttpCommandCodec.java

  • Added imports for org.jspecify.annotations.NullMarked and @Nullable
  • Applied @NullMarked annotation to the AbstractHttpCommandCodec class
  • Added @Nullable annotation to the equals() method's Object o parameter
+4/-1     
W3CHttpCommandCodec.java
Add JSpecify @NullMarked to W3CHttpCommandCodec class       

java/src/org/openqa/selenium/remote/codec/w3c/W3CHttpCommandCodec.java

  • Added import for org.jspecify.annotations.NullMarked
  • Applied @NullMarked annotation to the W3CHttpCommandCodec class
+2/-0     

@selenium-ci selenium-ci added the C-java Java Bindings label Oct 22, 2025
@qodo-merge-pro
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
🟢 Prefer non-null by default via @NullMarked where appropriate, and mark nullable values
with @nullable.
Apply annotations to relevant remote command codec components without changing runtime
behavior.
🔴 Add JSpecify Nullness annotations to Selenium Java code to indicate nullability for
parameters and return values.
Ensure annotations are IDE and static-analysis friendly, improving detection of potential
NullPointerExceptions.
Codebase Duplication Compliance
Codebase context is not defined

Follow the guide to enable codebase context checks.

Custom Compliance
No custom compliance provided

Follow the guide to enable custom compliance check.

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

@qodo-merge-pro
Copy link
Contributor

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
General
Add missing @nullable annotations

Add the @Nullable annotation to the sessionId parameter in the buildUri and
getParameter methods, as it can be null for certain commands.

java/src/org/openqa/selenium/remote/codec/AbstractHttpCommandCodec.java [112]

+public abstract class AbstractHttpCommandCodec implements CommandCodec<HttpRequest> {
 
-
  • Apply / Chat
Suggestion importance[1-10]: 7

__

Why: The suggestion correctly identifies that the sessionId parameter in buildUri and getParameter can be null, which contradicts the newly added class-level @NullMarked annotation, and proposes the necessary @Nullable fix.

Medium
  • More

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants