Revert "[java] make the signature change in ExecuteMethod backward compatible"#17184
Conversation
…compatib…" This reverts commit bd280c7.
|
|
Review Summary by QodoRevert ExecuteMethod backward compatibility changes and restore generic signatures
WalkthroughsDescription• Reverts backward compatibility changes to ExecuteMethod interface • Restores generic return type to execute() method signature • Removes three convenience methods: execute(String, Map, T), executeAs(), execute(String) • Introduces new executeRequired() method for non-null result handling • Updates all call sites to use executeRequired() where null-safety needed File Changes1. java/src/org/openqa/selenium/remote/ExecuteMethod.java
|
Code Review by Qodo
1. ExecuteMethod helpers removed
|
| @Nullable <T> T execute(String commandName, @Nullable Map<String, ?> parameters); | ||
|
|
||
| /** | ||
| * Execute the given command and return the default value if the command return null. | ||
| * | ||
| * @return non-nullable value of type T. | ||
| */ | ||
| @SuppressWarnings("unchecked") | ||
| default <T> T execute(String commandName, @Nullable Map<String, ?> parameters, T defaultValue) { | ||
| return (T) requireNonNullElse(execute(commandName, parameters), defaultValue); | ||
| } | ||
|
|
||
| /** | ||
| * Execute the given command and cast the returned value to T. | ||
| * | ||
| * @return non-nullable value of type T. | ||
| */ | ||
| @SuppressWarnings("unchecked") | ||
| default <T> T executeAs(String commandName, @Nullable Map<String, ?> parameters) { | ||
| return (T) requireNonNull(execute(commandName, parameters)); | ||
| } | ||
|
|
||
| /** | ||
| * Execute the given command without parameters and cast the returned value to T. | ||
| * | ||
| * @return non-nullable value of type T. | ||
| */ | ||
| @SuppressWarnings("unchecked") | ||
| default <T> T execute(String commandName) { | ||
| return (T) requireNonNull(execute(commandName, null)); | ||
| default <T> T executeRequired(String commandName, @Nullable Map<String, ?> parameters) { | ||
| return requireNonNull(execute(commandName, parameters)); | ||
| } |
There was a problem hiding this comment.
1. executemethod helpers removed 📘 Rule violation ✓ Correctness
The public ExecuteMethod interface no longer exposes previously available convenience/default methods and changes the execute API shape, forcing downstream users to update code when upgrading Selenium. This is a breaking public API change and removes public functionality without a deprecation/migration period.
Agent Prompt
## Issue description
`ExecuteMethod` has changed in a way that breaks external consumers by removing previously available public convenience/default methods and forcing call sites to migrate immediately.
## Issue Context
This PR is required to maintain API/ABI compatibility for user-facing changes and to deprecate public functionality before removing it.
## Fix Focus Areas
- java/src/org/openqa/selenium/remote/ExecuteMethod.java[40-44]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Reverts #17183