Treat void methods as deterministic#7690
Conversation
📝 WalkthroughWalkthroughThe purity checker now treats a method invocation as deterministic when the invoked method’s return type is Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (2)
dataflow/src/main/java/org/checkerframework/dataflow/util/PurityChecker.javaframework/tests/purity-suggestions/SideEffectFreeVoidMethod.java
|
@smillst |
There was a problem hiding this comment.
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
📒 Files selected for processing (1)
.github/workflows/ci.yml
There was a problem hiding this comment.
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
📒 Files selected for processing (1)
.github/workflows/ci.yml
Merge with plume-lib/plume-util#687.