From 2be5b68fc9284bcfbdd253319cfc44a3ffd8ca99 Mon Sep 17 00:00:00 2001 From: sergiparpal Date: Sat, 28 Nov 2026 16:15:27 +0100 Subject: [PATCH] [javadoc] StopWatch: split() can be called more than once 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 --- src/main/java/org/apache/commons/lang3/time/StopWatch.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/apache/commons/lang3/time/StopWatch.java b/src/main/java/org/apache/commons/lang3/time/StopWatch.java index 0f0e073ff7c..3fad94efdf3 100644 --- a/src/main/java/org/apache/commons/lang3/time/StopWatch.java +++ b/src/main/java/org/apache/commons/lang3/time/StopWatch.java @@ -57,7 +57,7 @@ *

* *
    - *
  1. {@link #split()}, {@link #suspend()}, or {@link #stop()} cannot be invoked twice
  2. + *
  3. {@link #suspend()} or {@link #stop()} cannot be invoked twice
  4. *
  5. {@link #unsplit()} may only be called if the watch has been {@link #split()}
  6. *
  7. {@link #resume()} may only be called if the watch has been {@link #suspend()}
  8. *
  9. {@link #start()} cannot be called twice without calling {@link #reset()}