Skip to content

Modifiability annotations - #301

Merged
mernst merged 164 commits into
typetools:masterfrom
mernst:modifiability-annos
Oct 4, 2026
Merged

mernst merged 164 commits into
typetools:masterfrom
mernst:modifiability-annos

Conversation

@mernst

@mernst mernst commented Oct 3, 2026

Copy link
Copy Markdown
Member

No description provided.

YukiYang31 and others added 30 commits November 25, 2025 12:21
YukiYang31 and others added 25 commits June 5, 2026 17:51
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
* `SimpleDeque`: add the missing import for `@SideEffectFree`, without
  which the jtreg support file does not compile.
* `Arrays.fill(long[], long)`: `@SideEffectsOnly("#1")` rather than
  `@Pure`; the body writes `a[i] = val`, and the 15 sibling overloads
  already use `@SideEffectsOnly("#1")`.
* `Collection`, `List`, `Set`, and `Collections.UnmodifiableEntrySet`:
  remove `@SideEffectFree` from `toArray(T[] a)`, which writes into the
  caller's array.  Commit aa68716 did this for the other
  implementations but missed these.
* `LinkedHashMap.keySet`: restore `@KeyFor({"this"})`, dropped by
  accident; `HashMap.keySet`, which it overrides, declares it.
* `HashMap.entrySet`: the receiver is `@PolyModifiable`, matching `Map`,
  `AbstractMap`, and `LinkedHashMap`.  `@PolyModifiable` in the return
  type had nothing to resolve against.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* Restore `@PolyNonEmpty` on `ArrayList.iterator()` and `ArrayList.listIterator()`.
* Remove unsound `@PolyNonEmpty` from `AbstractList.listIterator(int)`, which
  returns an empty iterator when the index equals the size.
* Annotate `Collections.emptyIterator()` as `@Unmodifiable`, consistent with
  `emptyListIterator()` and with the inherited `EmptyIterator.remove()`.
* Annotate the `SortedMap` and `NavigableMap` key accessors, and their
  overrides, as `@Pure` rather than `@SideEffectFree`, matching the `SortedSet`
  and `NavigableSet` accessors and `ConcurrentSkipListMap`.  `firstEntry()` and
  `lastEntry()` remain `@SideEffectFree` because each call returns a new entry.
* Annotate the set views that delegate to those accessors as `@Pure`.
* Move `@Modifiable` from the element type to the iterator in
  `IdentityHashMap.EntrySet.iterator()`.
* Fix formatting: merged declarations in `ConcurrentLinkedDeque` and
  `ListIterator`, trailing whitespace in `ConcurrentNavigableMap`, and missing
  spaces in `ConcurrentMap` and `NavigableSet`.
* Remove redundant imports and an unnecessary `@SuppressWarnings("unchecked")`
  from `Collections`.
* Fix a typo in `README.md`.
@coderabbitai

coderabbitai Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 1 minute.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository: typetools/jdk/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 4b6a136f-aea4-4b5d-aa8b-23e1191014ac
📥 Commits

Reviewing files that changed from the base of the PR and between 3c7ab3a and 537bd8c.

📒 Files selected for processing (4)
  • src/java.base/share/classes/java/lang/Object.java
  • src/java.base/share/classes/java/lang/ProcessBuilder.java
  • src/java.base/share/classes/java/util/Collections.java
  • src/java.base/share/classes/java/util/concurrent/ConcurrentHashMap.java
  • 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 a728389 into typetools:master Oct 4, 2026
72 of 73 checks passed
@mernst
mernst deleted the modifiability-annos branch October 4, 2026 20:24
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