Skip to content

Add @Shrinkable to List.remove for GrowOnlyChecker - #228

Closed
Damika-Anupama wants to merge 29 commits into
typetools:masterfrom
Damika-s-Play-Ground:growonly-checker
Closed

Add @Shrinkable to List.remove for GrowOnlyChecker#228
Damika-Anupama wants to merge 29 commits into
typetools:masterfrom
Damika-s-Play-Ground:growonly-checker

Conversation

@Damika-Anupama

@Damika-Anupama Damika-Anupama commented Jul 16, 2025

Copy link
Copy Markdown

related to the typetools/checker-framework PR "Growonly checker" typetools/checker-framework#7160

@mernst mernst 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.

This is missing methods removeFirst and removeLast.
Furthermore, you need to annotate methods in Collection, such as removeIf, and in Stack, such as pop, and others.
Please go through all collection classes in the JDK and annotate all methods that remove elements.

@Damika-Anupama
Damika-Anupama requested a review from mernst July 29, 2025 06:01
Comment thread README.md Outdated
Comment thread src/java.base/share/classes/java/util/AbstractList.java Outdated
Comment thread src/java.base/share/classes/java/util/AbstractSequentialList.java Outdated
Comment thread src/java.base/share/classes/java/util/Collections.java Outdated
@Damika-Anupama

Damika-Anupama commented Aug 5, 2025

Copy link
Copy Markdown
Author

I reverted 4 latest commits which were related to

  • Index-based Operations - Enhanced with precise index annotations
  • Size-returning Methods - Annotated with bounds

Removed commits:

  • 0a70f8c Add @indexfor and @IndexOrHigh annotations to JDK collection methods
  • 4bdc0fc Annotate methods that return a list's size
  • 43b258b Resolve import and annotation issues
  • 5382d67 Resolve import issues

Since these changes are not directly related to the grow-only checker, I cherry picked them to a separate branch and put a PR: Index annotations

@Damika-Anupama
Damika-Anupama requested a review from mernst August 6, 2025 05:05
* this class and provide implementations for the {@link #get(int)} and
* {@link List#size() size()} methods.
*
* <p>Note: Methods that can reduce the list size are annotated with

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.

Do not change the existing source code. Only add annotations. If you want to add a comment, use @CFComment.

@mernst mernst closed this Sep 10, 2025
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.

2 participants