Skip to content

Add comment to ProgressCallback doc#5286

Merged
holgerfriedrich merged 1 commit intoopenhab:mainfrom
cdjackson:progress-callback-doc
Feb 14, 2026
Merged

Add comment to ProgressCallback doc#5286
holgerfriedrich merged 1 commit intoopenhab:mainfrom
cdjackson:progress-callback-doc

Conversation

@cdjackson
Copy link
Contributor

ProgressCallback uses an iterator to step through the states, and there's no way to know the current state from the binding. The user is expected to call the next method to step the states, but the iterator is also stepped if update is called before the first call to next.

This doesn't feel very nice to me, and I would have preferred to handle this differently, but I didn't want to break the implementation in case others rely on this. Instead I've just added a note to the doc.

Signed-off-by: Chris Jackson chris@cd-jackson.com

Signed-off-by: Chris Jackson <chris@cd-jackson.com>
@cdjackson cdjackson requested a review from a team as a code owner January 18, 2026 22:07
@wborn wborn requested a review from Copilot January 20, 2026 08:59
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds documentation to clarify a non-intuitive behavior in the ProgressCallback interface where calling update() before next() will automatically advance the internal iterator to the first state.

Changes:

  • Added a note to the update() method documentation explaining the iterator advancement behavior
  • Reformatted the @throws clause for better readability

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

* This method can be used to provide detailed progress information additional to the sequence or even without a
* previous defined sequence.
* <br>
* Note that calling this method before the first call to next() will cause the iterator to be stepped to the first
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

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

The phrase "will cause the iterator to be stepped" should be "will cause the iterator to step" or "will step the iterator" for better readability. The passive voice construction here is awkward.

Suggested change
* Note that calling this method before the first call to next() will cause the iterator to be stepped to the first
* Note that calling this method before the first call to next() will step the iterator to the first

Copilot uses AI. Check for mistakes.
Copy link
Member

@holgerfriedrich holgerfriedrich left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@holgerfriedrich holgerfriedrich added this to the 5.2 milestone Feb 14, 2026
@holgerfriedrich holgerfriedrich merged commit 50aea47 into openhab:main Feb 14, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants