Skip to content

Review of Initialization Checker#1705

Merged
wmdietl merged 1 commit into
masterfrom
init-perf
May 11, 2026
Merged

Review of Initialization Checker#1705
wmdietl merged 1 commit into
masterfrom
init-perf

Conversation

@wmdietl
Copy link
Copy Markdown
Member

@wmdietl wmdietl commented May 11, 2026

No description provided.

Copilot AI review requested due to automatic review settings May 11, 2026 18:10
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refines parts of the Initialization Checker implementation, primarily by reducing expensive type/annotation work in common cases and simplifying some control flow during initialization reasoning.

Changes:

  • Refactors constructor-call detection in InitializationTransfer to avoid relying on toString() of getMethodSelect().
  • Adds early-return “cheap gates” and minor logic cleanups in InitializationParentAnnotatedTypeFactory to avoid unnecessary annotation/type computations.
  • Simplifies initialization-tracking checks in InitializationFieldAccessTreeAnnotator and clarifies initialization determination in InitializationAnnotatedTypeFactory.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
checker/src/main/java/org/checkerframework/checker/initialization/InitializationTransfer.java Refactors how this(...) / super(...) constructor calls are detected when computing newly-initialized fields.
checker/src/main/java/org/checkerframework/checker/initialization/InitializationParentAnnotatedTypeFactory.java Adds fast-path returns for common cases; simplifies some path-search logic; small cleanups in initialization qualifier handling.
checker/src/main/java/org/checkerframework/checker/initialization/InitializationFieldAccessTreeAnnotator.java Uses store-level field-initialization query instead of constructing/looking up initialized field declaration trees.
checker/src/main/java/org/checkerframework/checker/initialization/InitializationAnnotatedTypeFactory.java Refactors “all fields initialized” computation and uses a cheaper primitive check during uninitialized-field filtering.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +83 to +86
Name methodName =
(methodSelect instanceof IdentifierTree)
? ((IdentifierTree) methodSelect).getName()
: ((MemberSelectTree) methodSelect).getIdentifier();
@wmdietl wmdietl merged commit 8684b3b into master May 11, 2026
54 checks passed
@wmdietl wmdietl deleted the init-perf branch May 11, 2026 21:08
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