Skip to content

Treat void methods as deterministic#7690

Open
mernst wants to merge 15 commits intotypetools:masterfrom
mernst:sideeffectfree-void-method
Open

Treat void methods as deterministic#7690
mernst wants to merge 15 commits intotypetools:masterfrom
mernst:sideeffectfree-void-method

Conversation

@mernst
Copy link
Copy Markdown
Member

@mernst mernst commented May 3, 2026

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 3, 2026

📝 Walkthrough

Walkthrough

The purity checker now treats a method invocation as deterministic when the invoked method’s return type is void (adds TypeKind import and a void-return check in visitMethodInvocation). A new test SideEffectFreeVoidMethod was added (a @Pure method calling a @SideEffectFree void bounds-checker). A test class was renamed to VoidMethodIsDeterministic and its inline purity-error expectation was removed. Two purity message strings were reworded to explicitly reference @Deterministic. CI workflow gained a ci_info job. releaseVersion was bumped to 4.1.1-SNAPSHOT.

Possibly related PRs

Suggested reviewers

  • smillst
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@dataflow/src/main/java/org/checkerframework/dataflow/util/PurityChecker.java`:
- Around line 264-267: Add a short inline comment above the boolean det
computation in PurityChecker explaining that a void return type is treated as
deterministic because it cannot affect the caller's return value (side effects
are tracked separately by seFree), and note the potential confusion with the
existing messages.properties key purity.deterministic.void.method which phrases
“cannot be deterministic” so readers understand the difference; reference the
det variable, purityKinds / Pure.Kind.DETERMINISTIC check,
elt.getReturnType().getKind() == TypeKind.VOID, and seFree to localize the
explanation.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: c4a538f5-a319-4267-994b-f6bd1ded3023

📥 Commits

Reviewing files that changed from the base of the PR and between 80402f1 and fa81f56.

📒 Files selected for processing (2)
  • dataflow/src/main/java/org/checkerframework/dataflow/util/PurityChecker.java
  • framework/tests/purity-suggestions/SideEffectFreeVoidMethod.java

@mernst
Copy link
Copy Markdown
Member Author

mernst commented May 3, 2026

@smillst Let's merge this shortly before the next release, to reduce the time when the plume-lib job will fail (without further effort on our part). I made a snapshot release, so this can be merged along with plume-lib/plume-util#687.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/ci.yml:
- Line 318: The command invocation contains a stray double-quote after the
script name ("git-clone-related"), causing Bash to look for a file literally
named git-clone-related"; remove the extraneous quote or properly quote the
entire path so the argument is git-clone-related (e.g., change
checker/bin-devel/.git-scripts/git-clone-related" to
checker/bin-devel/.git-scripts/git-clone-related or wrap the full path in
matching quotes) so the git-clone-related script is invoked correctly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 452ac8f2-818a-4a3e-b3da-0f85912225cf

📥 Commits

Reviewing files that changed from the base of the PR and between 6b96500 and d1603d3.

📒 Files selected for processing (1)
  • .github/workflows/ci.yml

Comment thread .github/workflows/ci.yml Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/ci.yml:
- Around line 304-308: The ci_info job lacks an explicit timeout; add a
timeout-minutes entry to the ci_info job specification (the job named "ci_info")
to cap run time for this diagnostics-only job (e.g., timeout-minutes: 10);
update the job block that contains "runs-on: ubuntu-latest" and "container:
image: mdernst/cf-ubuntu-jdk25:latest" to include the timeout-minutes key.
- Around line 314-319: The job's run block intentionally includes a trailing
`false` which always returns exit code 1 and causes the `ci_info` job to fail;
remove the final `false` (or replace it with a meaningful command) after the
`checker/bin-devel/.git-scripts/git-clone-related --debug plume-lib plume-util
/tmp/plume-util` invocation so the job's exit status reflects the real outcomes
of `./gradlew --console=plain getPlumeScripts getGitScripts`,
`checker/bin-devel/.plume-scripts/ci-info --debug typetools`, and the git-clone
command instead of forcing a permanent failure.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 3afe1172-43c4-42ba-a92f-9429d62c20d6

📥 Commits

Reviewing files that changed from the base of the PR and between 8c7cd51 and a5d9591.

📒 Files selected for processing (1)
  • .github/workflows/ci.yml

Comment thread .github/workflows/ci.yml Outdated
Comment thread .github/workflows/ci.yml Outdated
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