Skip to content

chore: deprecate instance maxRetries - #1448

Merged
octonato merged 5 commits into
mainfrom
octonato/deprecate-static-max-retries
Apr 9, 2026
Merged

octonato merged 5 commits into
mainfrom
octonato/deprecate-static-max-retries

Conversation

@octonato

@octonato octonato commented Mar 25, 2026 •

Copy link
Copy Markdown
Contributor

We have seen that code assistants get confused with the static RecoveryStrategy.maxRetries and the Workflow.maxRetries.

RecoveryStrategy.maxRetries is a legacy method that were useful with the old Workflow API.

This PR deprecates the static one..

@@ -1452,7 +1452,7 @@ public StepSettings withRecovery(RecoverStrategy<?> recovery, Object stepLambda)
* @return MaxRetries strategy.
*/
public MaxRetries maxRetries(int maxRetries) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should do the opposite? See my reasoning in #1444 (comment)

maxRetries is the only instance method that is used as a factory method, aside from some top level effects, stepEffects and settings, Well, pauseSetting might be another one.

maxRetries is used like with for example:

defaultStepRecovery(RecoverStrategy<?> recoverStrategy)

I would find it more natural to type defaultStepRecovery(RecoverStrategy. and then complete that with IDE code completion. I wouldn't know that maxRetries exists as instance method unless looking at docs.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instance methods also have the drawback that we can't really add new methods, because they could name clash with existing user code

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, did the other way around. The instance one is deprecated now.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to check the AGENTS.md though. I think we added some notice about it there as well.

@octonato
octonato force-pushed the octonato/deprecate-static-max-retries branch from 35950fb to d21e16a Compare April 9, 2026 08:14
@octonato octonato changed the title chore: deprecate static maxRetries chore: deprecate instance maxRetries Apr 9, 2026
@github-actions github-actions Bot added the documentation documentation related label Apr 9, 2026

@octonato octonato left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed now all references to the now deprecated maxRetries by an explicit usage of the static one from RecoverStrategy.

Also removed the notice we had in the AGENTS.md.

@patriknw patriknw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@octonato
octonato merged commit 696e6d5 into main Apr 9, 2026
37 checks passed
@octonato
octonato deleted the octonato/deprecate-static-max-retries branch April 9, 2026 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation documentation related java-sdk

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants