Skip to content

Fix incorrect @SideEffectsOnly indices in BitSet, StringLatin1, and StringUTF16 - #302

Merged
mernst merged 1 commit into
typetools:masterfrom
mernst:issue8325
Oct 8, 2026
Merged

mernst merged 1 commit into
typetools:masterfrom
mernst:issue8325

Conversation

@mernst

@mernst mernst commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

Fixes typetools/checker-framework#8325.

  • BitSet.clear(), clear(int), and clear(int, int): @SideEffectsOnly("#1") → @SideEffectsOnly("this"). #1 does not exist for clear() and is an int for the other two; all three mutate the receiver.
  • StringLatin1.getChars and StringUTF16.getChars: @SideEffectsOnly("#3") → @SideEffectsOnly("#4"). #3 is int srcEnd; #4 is the char[] dst that is written.

The test case is in the companion checker-framework pull request: typetools/checker-framework#8326

@coderabbitai

coderabbitai Bot commented Oct 7, 2026

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: typetools/jdk/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: e4f6c3a3-306b-48c5-b693-11fd995a5e7b
📥 Commits

Reviewing files that changed from the base of the PR and between a728389 and d58620e.

📒 Files selected for processing (3)
  • src/java.base/share/classes/java/lang/StringLatin1.java
  • src/java.base/share/classes/java/lang/StringUTF16.java
  • src/java.base/share/classes/java/util/BitSet.java

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The changes update @SideEffectsOnly targets in StringLatin1.getChars and StringUTF16.getChars from #3 to #4. They also update all three BitSet.clear overloads to target this instead of #1. Method signatures and clearing behavior are unchanged.

Priority: ➖ Normal

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to d5862

The annotations now identify the objects these methods mutate, without changing runtime behavior. No actionable merge risk remains.

Security Architecture Review

Security architecture risk: ⚪ Minimal · up to d5862

The corrected annotations identify the objects these methods already modify. Method signatures and implementations remain unchanged, and the review found no material security risk introduced or worsened by this correction.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The demonstrated change is limited to mutation metadata on five existing methods. The full comparison shows no new caller or executable path that expands attacker-controlled reachability or grants additional authority. Effects on external annotation consumers were not independently verified.
🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The StringLatin1.getChars and StringUTF16.getChars changes replace @SideEffectsOnly("#3") with @SideEffectsOnly("#4"). Linked issue [#8325] concerns only the three BitSet.clear overloads and… Remove the unrelated StringLatin1.getChars and StringUTF16.getChars annotation changes, or link them to a directly relevant active issue and provide scope evidence.
Docstring Coverage ⚠️ Warning Docstring coverage is 42.86% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Issue [#8325] requires @SideEffectsOnly("this") on all three BitSet.clear overloads. The reviewed change replaces @SideEffectsOnly("#1") with @SideEffectsOnly("this") on all three declarations…
Full details: Out of Scope Changes check

Explanation

The StringLatin1.getChars and StringUTF16.getChars changes replace @SideEffectsOnly("#3") with @SideEffectsOnly("#4"). Linked issue [#8325] concerns only the three BitSet.clear overloads and provides no requirement for these String declarations. The reviewed evidence does not connect these changes to the linked issue.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@mernst
mernst merged commit f5572a6 into typetools:master Oct 8, 2026
49 checks passed
@mernst
mernst deleted the issue8325 branch October 8, 2026 15:03
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.

4.3.0: BitSet.clear() fails with flowexpr.parse.index.too.big — @SideEffectsOnly("#1") on a no-arg method

1 participant