Repository navigation
[javadoc] StopWatch: split() can be called more than once - #1899
Merged
Merged
Conversation
The class Javadoc says that split(), suspend(), or stop() cannot be invoked twice. suspend() and stop() do throw IllegalStateException the second time, but split() only requires the watch to be running. It has done so since the rule was written for Lang 2.1, and since 3.20.0 each call adds a split to getSplits(). StopWatchTest's testSplitsWithStringLabels() splits three times in a row. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
garydgregory
added a commit
that referenced
this pull request
Nov 29, 2026
Member
|
@sergiparpal Thank you for the PR; merged 🚀 |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The class Javadoc of
StopWatchlists the calls it protects against. Its first item reads:That holds for
suspend()andstop(), which throwIllegalStateExceptionthe second time. It does not hold forsplit(), which only requires the watch to be running: calling it again records another split. Since 3.20.0 each split is kept ingetSplits(), andStopWatchTest.testSplitsWithStringLabels()splits three times in a row.split()has never checked for an earlier split: in every release since the list was written (2.1), its only check is that the watch is running.This PR removes
split()from that item. It changes Javadoc only.mvn; that'smvnon the command line by itself.