Skip to content

Add Modifiability Annotations - #297

Merged
smillst merged 158 commits into
typetools:masterfrom
YukiYang31:modifiability
Oct 1, 2026
Merged

smillst merged 158 commits into
typetools:masterfrom
YukiYang31:modifiability

Conversation

YukiYang31 and others added 30 commits November 25, 2025 12:21
YukiYang31 and others added 21 commits June 3, 2026 12:21
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>
@coderabbitai

coderabbitai Bot commented Sep 20, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Repository: typetools/jdk/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 48c75754-e26e-4443-964f-957bca7a237b


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.

* 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`.
@smillst
smillst merged commit 3c7ab3a into typetools:master Oct 1, 2026
49 checks passed
@smillst
smillst deleted the modifiability branch October 1, 2026 16:55
@YukiYang31
YukiYang31 restored the modifiability branch October 1, 2026 23:51
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