sdk-java icon indicating copy to clipboard operation
sdk-java copied to clipboard

`startUpdate` JavaDoc says "asynchronously" when it may not be

Open rgrochowicz opened this issue 6 months ago • 1 comments

Expected Behavior

The JavaDoc for startUpdate should indicate that when it's called with a waitForStage of WorkflowUpdateStage.COMPLETED, it's synchronous and blocks until the update is completed.

Actual Behavior

The JavaDoc for startUpdate says the following:

Start a zero argument update workflow request asynchronously.

However, the following code will block until the update is completed:

val updateOptions =
  UpdateOptions.newBuilder<UpdateResult>()
    .setResultClass(UpdateResult::class.java)
    .setWaitForStage(WorkflowUpdateStage.COMPLETED)
    .setUpdateId(updateId)
    .build()
val update = WorkflowClient.startUpdate(stub::doUpdate, updateOptions) // <-- blocks here
val result = update.getResult(5, TimeUnit.SECONDS)

The JavaDoc implies that startUpdate would ignore the waitForStage, always be asynchronous, and block on the update.getResult.

Steps to Reproduce the Problem

  1. Look at JavaDoc for startUpdate
  2. Assume startUpdate is always asynchronous
  3. Call startUpdate with a waitForStage of WorkflowUpdateStage.COMPLETED
  4. See that the startUpdate call was actually synchronous

Specifications

  • Version: latest master
  • Platform: n/a

Requesting that either the word asynchronously is removed from the JavaDoc for the startUpdate methods or it's clear that the function isn't asynchronous in a normal sense.

Thanks!

rgrochowicz avatar Jun 30 '25 21:06 rgrochowicz

This is the sort of small change we'd be more than happy to accept a PR for if you're interested!

Sushisource avatar Jul 02 '25 17:07 Sushisource