Skip to content

Clarify JavaParserUtil.resolveTypeName comments - #8173

Merged
mernst merged 1 commit into
typetools:masterfrom
mernst:javaparser-resolve-type-name-comments
Sep 16, 2026
Merged

mernst merged 1 commit into
typetools:masterfrom
mernst:javaparser-resolve-type-name-comments

Conversation

@mernst

@mernst mernst commented Sep 15, 2026 •

Copy link
Copy Markdown
Member

JavaParserUtil.resolveTypeName looks names up in a particular order, because a name in scope shadows one that is not. Document why each lookup is where it is: a type parameter takes precedence over everything, a type in the same package over one in java.lang, and any type in scope over the interpretation of the name as fully-qualified.

Also replace importedName.length() > firstComponent.length() by the equivalent but clearer !importedName.equals(firstComponent): the test is asking whether the import has a qualifier, not comparing lengths.

No behavior change.

🤖 Generated with Claude Code

Document why a type parameter, a type in the same package, and a
fully-qualified name are looked up in the order they are.  Replace the
`importedName.length() > firstComponent.length()` test by the equivalent but
clearer `!importedName.equals(firstComponent)`.

No behavior change.

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

coderabbitai Bot commented Sep 15, 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: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 72e72810-0527-42be-91ed-5b75df57093c

📥 Commits

Reviewing files that changed from the base of the PR and between b87c803 and 61e9632.

📒 Files selected for processing (1)
  • framework/src/main/java/org/checkerframework/framework/util/JavaParserUtil.java

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


📝 Walkthrough

Walkthrough

Updated resolveTypeName comments to document type-parameter shadowing, same-package precedence, and final fully qualified name lookup. Renamed the local variable generic to genericDeclaration. Replaced the static-import guard with an equivalent equality check. No functional behavior changes were made.

Priority: ⬇️ Low

Change: Other

Merge Risk: ⚪ Minimal · up to 61e96

This change only clarifies documentation, renames a local variable, and preserves the existing predicate behavior.

🚥 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 1 functions across 1 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 PR with unit tests

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 self-assigned this Sep 15, 2026
@mernst
mernst merged commit 1a4909e into typetools:master Sep 16, 2026
27 checks passed
@mernst
mernst deleted the javaparser-resolve-type-name-comments branch September 16, 2026 02:37
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