[java] JSpecify annotations for `ExecuteMethod` by mk868 · Pull Request #16464 · SeleniumHQ/selenium
Conversation
User description
🔗 Related Issues
Related #14291
💥 What does this PR do?
JSpecify annotations added to the:
org.openqa.selenium.remote.ExecuteMethodorg.openqa.selenium.remote.RemoteExecuteMethod
🔧 Implementation Notes
💡 Additional Considerations
🔄 Types of changes
- New feature (non-breaking change which adds functionality and tests!)
PR Type
Enhancement
Description
-
Add JSpecify null-safety annotations to
ExecuteMethodinterface -
Add JSpecify null-safety annotations to
RemoteExecuteMethodimplementation -
Mark
parametersparameter as@Nullablein both classes -
Apply
@NullMarkedclass-level annotation for default non-null semantics
Diagram Walkthrough
flowchart LR
A["ExecuteMethod interface"] -->|"add @NullMarked"| B["Null-safety annotations"]
A -->|"mark parameters @Nullable"| B
C["RemoteExecuteMethod class"] -->|"add @NullMarked"| B
C -->|"mark parameters @Nullable"| B
File Walkthrough
| Relevant files | |||||
|---|---|---|---|---|---|
| Enhancement |
|
PR Compliance Guide 🔍
Below is a summary of compliance checks for this PR:
| Security Compliance | ||||||
| ⚪ | Null parameter handlingDescription: Passing a null map to lower-level driver.execute could cause unexpected behavior if Referred Codepublic Object execute(String commandName, @Nullable Map<String, ?> parameters) { Response response; if (parameters == null || parameters.isEmpty()) { response = driver.execute(commandName); } else { | |||||
| Ticket Compliance | ||||||
| 🟡 |
🎫 #14291
| |||||
| Codebase Duplication Compliance | ||||||
| ⚪ | Codebase context is not definedFollow the guide to enable codebase context checks. | |||||
| Custom Compliance | ||||||
| ⚪ | No custom compliance providedFollow the guide to enable custom compliance check. | |||||
| ||||||
Compliance status legend
🟢 - Fully Compliant🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label
PR Code Suggestions ✨
Explore these optional code suggestions:
| Category | Suggestion | Impact |
| General |
Annotate method return type as nullableAnnotate the return type of the java/src/org/openqa/selenium/remote/ExecuteMethod.java [38] -Object execute(String commandName, @Nullable Map<String, ?> parameters); +@Nullable Object execute(String commandName, @Nullable Map<String, ?> parameters);
Suggestion importance[1-10]: 8__ Why: The suggestion correctly points out that the | Medium |
| Learned best practice |
Clarify Javadoc for nullabilityUpdate the Javadoc to document that java/src/org/openqa/selenium/remote/ExecuteMethod.java [30-38] /** - * Execute the given command on the remote webdriver server. Any exceptions will be thrown by the + * Execute the given command on the remote WebDriver server. Any exceptions will be thrown by the * underlying execute method. * - * @param commandName The remote command to execute - * @param parameters The parameters to execute that command with - * @return The result of {@link Response#getValue()}. + * @param commandName the remote command to execute + * @param parameters the parameters to execute that command with; may be {@code null} or empty to indicate no parameters + * @return the value from {@link Response#getValue()} */ Object execute(String commandName, @Nullable Map<String, ?> parameters);
Suggestion importance[1-10]: 6__ Why: | Low |
| ||
mk868
deleted the
jspecify-ExecuteMethod
branch
This was referenced
Oct 25, 2025This was referenced
Dec 16, 2025This was referenced
Jan 19, 2026This was referenced
Feb 11, 2026This was referenced
Feb 20, 2026This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters