Skip to content

Fix documentation errors in Java.Util.Concurrent, Java.Util.Concurrent.Atomic, Java.Util.Concurrent.Locks and Java.Util.Functions (R080, pass 3) - #1959

Merged
jonathanpeppers merged 1 commit into
mainfrom
jonathanpeppers-review-java-util-concurrent-docs-r080
Nov 28, 2026
Merged

jonathanpeppers merged 1 commit into
mainfrom
jonathanpeppers-review-java-util-concurrent-docs-r080

Conversation

@jonathanpeppers

Copy link
Copy Markdown
Member

Agent assessment

Self-reported assessment, not an independent review.

Assessed revision: a2e93bb08ed00176982d808f929a639ecef5d2ee

Dimension Assessment Rationale
Change confidence 9.5/10 ↑ One-phrase edit; the XML parses and git diff --check passes.
↑ CyclicBarrier.java dowait checks g.broken before the timeout check.
↑ The Gemini 4 Argon review found no issues.
↓ OpenPublishing.Build has not run yet.
Diagnosis confidence 9.5/10 ↑ The source shows that a broken barrier throws BrokenBarrierException, not TimeoutException.
↑ Pass-2 human reviewer follow-up requested this change.
Evidence fit 9/10 ↑ The text matched the reported omission exactly.
↓ The old text was incomplete, not false for the timeout case.

Scope

Pass-3 review of item R080: 146 files in Java.Util.Concurrent, Java.Util.Concurrent.Atomic, Java.Util.Concurrent.Locks and Java.Util.Functions. I reviewed only the text that changed in git diff 86f7744a1 origin/main, including the pass-2 edits from #1769.

  • AI-changed channels in scope: 1159 (summary, remarks, value, each param, returns). Each channel has a personal ledger row with a numeric pinned source line and the fact that I checked: 1159 of 1159.
  • Formatting-only changes (189) and deferred boilerplate (328, such as ThresholdClass, ThresholdType and JniPeerMembers) were not reviewed, as the review rules say.
  • Sources: Android libcore (ojluni) from SDK source 37.2 r01, SHA-256 9d637c3af6654a2f1b696b3d19c54bb77e38df2b0106116934703f314b3d4e84. Async wrappers: dotnet/android@9bc18c7, external/Java.Interop/tools/generator/SourceWriters/MethodAsyncWrapper.cs L33 and MethodExtensionAsyncWrapper.cs L27 (Task.Run(() => ...)).

Fixes

  1. CyclicBarrier.AwaitAsync(long, TimeUnit) <returns>: "If the wait times out before the barrier is tripped," is now "If the wait times out before the barrier is tripped or broken,".
    • Evidence: java/util/concurrent/CyclicBarrier.java dowait checks g.broken at L251 and throws BrokenBarrierException before the timeout check at L257. A wait therefore times out only when the barrier is neither tripped nor broken. This matches the sync Await(long, TimeUnit) Javadoc. The pass-2 reviewer also asked for this change.

Uncertain findings

None.

Out of scope (pass-2 follow-up notes)

  • LinkedBlockingQueue.Offer(Object, long, TimeUnit) remarks: this text is verbatim imported Javadoc, not AI-changed. Only the params were changed, and they are correct. For information: LinkedBlockingQueue.java L356–378 returns false when nanos <= 0 only while the queue is full.
  • CountDownLatch.Await(long, TimeUnit) (sync): the AI did not change this text. Only the AwaitAsync members were changed, and they are correct (CountDownLatch.java await(long, TimeUnit) returns false if the waiting time elapses before the count reaches zero).

Checks

  • Parsed the changed XML file. CRLF line endings are unchanged (the blob uses LF with core.autocrlf); only the 10 added characters changed.
  • git diff --check passed. No new placeholders.
  • I checked every AI-changed channel against the pinned source myself and recorded a verdict: 1158 correct, 1 fixed.
  • Gemini 4 Argon rubber-duck review: no findings. It checked the fix and spot-checked ledger rows. The model is verified in the local assistant_usage_events (23 gemini-4-argon rows for this session).

The timed wait times out only if the barrier is neither tripped nor broken.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 28, 2026 06:07
@jonathanpeppers
jonathanpeppers enabled auto-merge (squash) November 28, 2026 06:07

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

There are no active review issues for this documentation-only clarification of timed barrier waits.

No open issues 🎉

What changed in this PR

This documentation-only follow-up to #1769 clarifies the timeout behavior of CyclicBarrier.AwaitAsync(long, TimeUnit).

Changes:

  • Specifies that the task faults with TimeoutException when the wait times out before the barrier is tripped or broken.
  • Leaves API signatures and runtime behavior unchanged.
File Description
docs/​xml/​Java.Util.Concurrent/​CyclicBarrier.xml Clarifies the timed AwaitAsync return documentation to account for a broken barrier.

Review effort: Balanced

@jonathanpeppers

Copy link
Copy Markdown
Member Author

@dalexsoto review

@dalexsoto

Copy link
Copy Markdown
Member

In response to @jonathanpeppers's request: The changed timeout sentence matches the inspected CyclicBarrier implementation, and the Task.Run wrapper is checked. I still need to read CyclicBarrier.xml lines 1-448 and 493 through the end, and establish immutable-source correspondence for the libcore body before the complete-file final pass. This is a reviewer coverage gap, not an identified defect in the PR. Those reads were not completed in this review window; there was no source-fetch failure.

@dalexsoto dalexsoto left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Approving. The one-line change to AwaitAsync(long, TimeUnit) in CyclicBarrier.xml (L486) is correct.

  • Matches AOSP behaviour. In libcore CyclicBarrier.dowait, the broken check (L251) and the tripped/generation check (L254) both run before the timeout check (L257-259). A TimeoutException is therefore only thrown when the barrier is neither tripped nor broken. If the barrier is already broken, or breaks during the wait (interrupt, another party's timeout, Reset), BrokenBarrierException is thrown instead, so "before the barrier is tripped or broken" is the accurate wording.
  • The async wrapper inherits this. The generator's MethodAsyncWrapper (dotnet/android@9bc18c75, external/Java.Interop/tools/generator/SourceWriters/MethodAsyncWrapper.cs L33) wraps the synchronous Await(timeout, unit) in Task.Run, so these Java exceptions fault the returned task.
  • The rest of the sentence still holds. breakBarrier() runs right before TimeoutException is thrown, so "the barrier enters the broken state" and IsBroken returning true are still accurate.
  • The rest of the file is consistent. I read the whole file: Await(long, TimeUnit) (L396-427), Await(), IsBroken and Reset all agree. AwaitAsync() has no timeout wording, so it doesn't need the same fix, and no other member uses the old phrase.
  • No markup changes. The crefs (T:Java.Util.Concurrent.TimeoutException, P:Java.Util.Concurrent.CyclicBarrier.IsBroken) resolve, and the file still parses as XML.
  • No base-branch conflict. CyclicBarrier.xml is unchanged on main since the PR's merge base.

I found no blocking issues. This was a static review; I didn't run any builds or tests.

@jonathanpeppers
jonathanpeppers merged commit 32a6de4 into main Nov 28, 2026
4 checks passed
@jonathanpeppers
jonathanpeppers deleted the jonathanpeppers-review-java-util-concurrent-docs-r080 branch November 28, 2026 06:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants