Skip to content

Correct order of type resolution - #8255

Merged
mernstcheckerframework merged 1 commit into
typetools:masterfrom
mernst:relevance-ancillary
Sep 22, 2026
Merged

mernstcheckerframework merged 1 commit into
typetools:masterfrom
mernst:relevance-ancillary

Conversation

@mernst

@mernst mernst commented Sep 22, 2026

Copy link
Copy Markdown
Member

Four changes to JavaParserUtil that were made while working on #8208, but that are independent of it.

  • Move the test for a local type declaration in resolveTypeName above the test for a type parameter, to group the two shadowing tests that return null, and say that a local class shadows a type parameter of the same name. Neither a BlockStmt nor a SwitchEntry is a NodeWithTypeParameters, so no iteration of the loop can take both branches, and the order does not affect the result.
  • Say why resolveTypeName searches every member type that the enclosing type declares, whatever its access modifier is.
  • Document that typeToTypeMirror returns null for a use of a type variable, which it already did.
  • Replace the private resolveTypeName overload's vague "reads and writes a cache, for efficiency" by what that cache does.

Every change but the first is a comment or Javadoc change.

Testing: :framework:compileJava, spotlessJavaCheck, and :framework:javadoc pass. :framework:javadoc reports no warning in JavaParserUtil other than one that is already present on master.

🤖 Generated with Claude Code

Four changes to `JavaParserUtil` that were made while working on typetools#8208, but
that are independent of it:

* Move the test for a local type declaration in `resolveTypeName` above the
  test for a type parameter, to group the two shadowing tests that return
  null, and say that a local class shadows a type parameter of the same
  name.  Neither a `BlockStmt` nor a `SwitchEntry` is a
  `NodeWithTypeParameters`, so no iteration of the loop can take both
  branches and the order does not affect the result.
* Say why `resolveTypeName` searches every member type that the enclosing
  type declares, whatever its access modifier is.
* Document that `typeToTypeMirror` returns null for a use of a type
  variable, which it already did.
* Replace the private `resolveTypeName` overload's vague "reads and writes a
  cache, for efficiency" by what that cache does.

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

coderabbitai Bot commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Next included review available in 4 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

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

Learn how review limits work.

Review configuration:

⚙️ Run configuration

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

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 4bdd099c-2a08-435b-bf1f-e4faf343caea

📥 Commits

Reviewing files that changed from the base of the PR and between 6b16237 and 7ba6af1.

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

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.

@mernstcheckerframework mernstcheckerframework changed the title Small changes ancillary to resolving a type variable's name Correct order of type resolution Sep 22, 2026
@mernstcheckerframework
mernstcheckerframework enabled auto-merge (squash) September 22, 2026 06:26
@mernstcheckerframework
mernstcheckerframework merged commit 2f20be2 into typetools:master Sep 22, 2026
27 checks passed
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