You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
New feature (non-breaking change which adds functionality and tests!)
PR Type
Enhancement
Description
Add JSpecify null-safety annotations to ExecuteMethod interface
Add JSpecify null-safety annotations to RemoteExecuteMethod implementation
Mark parameters parameter as @Nullable in both classes
Apply @NullMarked class-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
Below is a summary of compliance checks for this PR:
Security Compliance
⚪
Null parameter handling
Description: Passing a null map to lower-level driver.execute could cause unexpected behavior if downstream assumptions change; however current code guards null before calling, so this is only a potential risk if future edits remove the guard. RemoteExecuteMethod.java [36-41]
Why: The suggestion correctly points out that the @NullMarked annotation introduces an incorrect non-null contract for the method's return type, as the implementation can return null. Adding @Nullable is crucial for API correctness and to prevent potential runtime errors for clients.
Medium
Learned best practice
Clarify Javadoc for nullability
Update the Javadoc to document that parameters may be null and what null/empty imply. Clarify return type/value expectations.
/**
- * 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);
Apply / Chat
Suggestion importance[1-10]: 6
__
Why:
Relevant best practice - Keep API and documentation accurate and consistent by updating Javadoc to reflect nullability and parameter semantics.
This 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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
PR Type
Enhancement
Description
Add JSpecify null-safety annotations to
ExecuteMethodinterfaceAdd JSpecify null-safety annotations to
RemoteExecuteMethodimplementationMark
parametersparameter as@Nullablein both classesApply
@NullMarkedclass-level annotation for default non-null semanticsDiagram Walkthrough
File Walkthrough
ExecuteMethod.java
Add JSpecify null-safety annotations to interfacejava/src/org/openqa/selenium/remote/ExecuteMethod.java
@NullMarkedand@Nullable)@NullMarkedclass-level annotation to interfaceparametersparameter as@Nullableinexecute()method signatureRemoteExecuteMethod.java
Add JSpecify null-safety annotations to implementationjava/src/org/openqa/selenium/remote/RemoteExecuteMethod.java
@NullMarkedand@Nullable)@NullMarkedclass-level annotation to implementation classparametersparameter as@Nullableinexecute()method override