Skip to content

Fix checkerName to return the part before the colon - #8217

Open
mernst wants to merge 1 commit into
typetools:masterfrom
mernst:stub-fix-high-1
Open

mernst wants to merge 1 commit into
typetools:masterfrom
mernst:stub-fix-high-1

Conversation

@mernst

@mernst mernst commented Sep 19, 2026

Copy link
Copy Markdown
Member

RemoveAnnotationsForInference.checkerName is documented (by its name, its Javadoc summary, and its @return clause) to return the part of a @SuppressWarnings string before the colon, but its body returned s.substring(colonPos + 1), the part after the colon.

Its only caller, suppresses, compares the result against the parts of the annotation's fully-qualified name and against "allcheckers". So @SuppressWarnings("nullness:assignment") yielded "assignment", which never matches any part of org.checkerframework.checker.nullness.qual.NonNull, and @SuppressWarnings("allcheckers:purity") yielded "purity", which does not match "allcheckers". The effect was that annotations under the scope of a @SuppressWarnings with a message key were removed, even though isSuppressed exists to retain them.

Also adds RemoveAnnotationsForInferenceTest, which tests suppresses for suppression strings with and without a message key. Three of its five tests fail before this change.

🤖 Generated with Claude Code

The method name, its Javadoc, and its only caller all expect the checker
name, but the body returned the message key instead.  As a result, a
@SuppressWarnings with a message key, such as
@SuppressWarnings("nullness:assignment"), suppressed nothing, so
RemoveAnnotationsForInference removed annotations that it should have
retained.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: typetools/checker-framework/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 683309d5-b2a1-4f45-bc12-23dd2ac60e55

📥 Commits

Reviewing files that changed from the base of the PR and between c3bb1ac and ac2bd79.

📒 Files selected for processing (2)
  • framework/src/main/java/org/checkerframework/framework/stub/RemoveAnnotationsForInference.java
  • framework/src/test/java/org/checkerframework/framework/stub/RemoveAnnotationsForInferenceTest.java

Included review availability: Your plan provides up to 4 included reviews per hour; 2 remain after this review.


📝 Walkthrough

Walkthrough

checkerName now extracts the text before the colon in @SuppressWarnings strings. A new test class covers checker-name matching, message-key strings, multiple suppression values, special annotations, and ambiguous fully qualified annotation names.

Priority: ⬇️ Low

Change: Bug fix

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 2 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

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.

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.

1 participant