Skip to content

Conversation

@vivek-0509
Copy link

Fixes #6620

The crash originated from Java's String.split() behavior. In GenericAnnotatedTypeFactory.processCFGVisualizerOption(), when processing outdir= (empty value), the call "outdir=".split("=") returns ["outdir"] (length 1) instead of ["outdir", ""] (length 2), because Java's split() removes trailing empty strings by default. This caused the case 1 branch to execute, storing ("outdir", true) as a Boolean instead of ("outdir", "") as a String. When DOTCFGVisualizer.init() later tried to cast this Boolean to String, it crashed with ClassCastException.

Fix: Changed split("=") to split("=", -1) to preserve trailing empty strings, and added validation in DOTCFGVisualizer.init() to throw a helpful UserError when outdir is empty

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 16, 2026

📝 Walkthrough

Walkthrough

The changes make two validations related to CFG visualization options. Option parsing now uses split("=", -1), so options with a trailing = produce an explicit empty value. DOTCFGVisualizer.init adds a check that throws a UserError if the outdir string is empty. Empty outdir= inputs now produce an explicit error instead of proceeding.

🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning Documentation additions of contributor names are unrelated to the core objective of fixing the CFGVisualizer outdir crash. Remove contributor name changes from contributors.tex. These documentation updates should be handled separately or generated automatically by maintainers.
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The PR correctly implements parsing fix and validation as required by issue #6620, preventing crashes from empty outdir values.

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


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.

Fix crash with empty -Acfgviz outdir option (typetools#6620)

Fix crash with empty -Acfgviz outdir option (typetools#6620)
@vivek-0509 vivek-0509 force-pushed the issue-6620-validate-outdir branch from 221d4c5 to 15c8806 Compare January 16, 2026 18:43
Copy link
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

🤖 Fix all issues with AI agents
In `@docs/manual/contributors.tex`:
- Around line 150-151: Remove the duplicate GitHub username entry by deleting
the line containing "vivek-0509" and keep only the real name "Vivek Singh
Solanki" in the contributors list; ensure the remaining entry matches the
existing formatting (capitalization and trailing comma) used by other names in
the file so the contributors.tex list stays consistent.

Comment on lines +150 to +151
Vivek Singh Solanki,
vivek-0509,
Copy link
Contributor

@coderabbitai coderabbitai bot Jan 17, 2026

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Duplicate contributor entry — keep only the real name.

Both "Vivek Singh Solanki" (line 150) and "vivek-0509" (line 151) refer to the same contributor. The convention in this file is to list contributors by their real name when available. Please remove the GitHub username entry to avoid duplication.

Suggested fix
 Vitalii Ananiev,
 Vivek Singh Solanki,
-vivek-0509,
 Vladimir Sitnikov,
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Vivek Singh Solanki,
vivek-0509,
Vivek Singh Solanki,
🤖 Prompt for AI Agents
In `@docs/manual/contributors.tex` around lines 150 - 151, Remove the duplicate
GitHub username entry by deleting the line containing "vivek-0509" and keep only
the real name "Vivek Singh Solanki" in the contributors list; ensure the
remaining entry matches the existing formatting (capitalization and trailing
comma) used by other names in the file so the contributors.tex list stays
consistent.

Copy link
Author

@vivek-0509 vivek-0509 Jan 17, 2026

Choose a reason for hiding this comment

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

@mernst i actually added only the one name but the CI was failing so added both the names.

Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

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.

Crash with bad CFGVisualizer outdir=

1 participant