Avoid /bin/sh -c#7787
Conversation
|
Warning Review limit reached
Next review available in: 4 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR removes shell-based subprocess execution in two places. Related issues: None provided 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✨ 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.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
framework/src/main/java/org/checkerframework/framework/stub/AnnotationFileElementTypes.java (1)
897-898: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRedundant re-sorting of jar entry names.
entriesis already sorted byComparator.comparing(Object::toString)at Line 898, thenjarEntryNames(built from the sameentrieslist) is sorted again insideprintSortedIndented. Since this is debug-only output on a rarely-hit path, the duplication is harmless but avoidable.♻️ Optional simplification
- List<String> jarEntryNames = new ArrayList<>(entries.size()); - for (JarEntry jarEntry : entries) { - jarEntryNames.add(jarEntry.getName()); - } - printSortedIndented(jarEntryNames); + List<String> jarEntryNames = + entries.stream().map(JarEntry::getName).collect(Collectors.toList()); + printSortedIndented(jarEntryNames);Also applies to: 930-935
🤖 Prompt for 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. In `@framework/src/main/java/org/checkerframework/framework/stub/AnnotationFileElementTypes.java` around lines 897 - 898, The jar entry list in AnnotationFileElementTypes is being sorted twice: once when building entries with Comparator.comparing(Object::toString) and again later when jarEntryNames is passed to printSortedIndented. Remove the redundant second sort by reusing the already-sorted entries list (and the same pattern in the later matching block), keeping the debug-only output unchanged while avoiding duplicate work.dataflow/src/main/java/org/checkerframework/dataflow/cfg/visualize/CFGVisualizeLauncher.java (1)
328-337: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick winProcessBuilder replacement looks correct.
Equivalent behavior to the prior
/bin/sh -cinvocation, and avoids shell injection risk sincefileis passed as a discrete argument rather than interpolated into a shell command string.One gap (pre-existing, not introduced by this diff):
child.waitFor()'s exit code is never checked, so a failingdotinvocation (e.g., binary missing or malformed dot file) silently produces no PDF without any error message.♻️ Optional: surface non-zero exit codes
ProcessBuilder pb = new ProcessBuilder("dot", "-Tpdf", file, "-o", file + ".pdf"); Process child = pb.start(); - child.waitFor(); + int exitCode = child.waitFor(); + if (exitCode != 0) { + System.err.println("dot exited with status " + exitCode); + } } catch (InterruptedException | IOException e) {🤖 Prompt for 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. In `@dataflow/src/main/java/org/checkerframework/dataflow/cfg/visualize/CFGVisualizeLauncher.java` around lines 328 - 337, The producePDF method starts the dot process and waits for it, but it never checks the child exit status, so failures are silent. Update producePDF to inspect the result of child.waitFor() after launching the ProcessBuilder and, when the exit code is non-zero, report an error and exit similarly to the existing exception handling; use the producePDF and child symbols to locate the change.
🤖 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.
Outside diff comments:
In
`@dataflow/src/main/java/org/checkerframework/dataflow/cfg/visualize/CFGVisualizeLauncher.java`:
- Around line 328-337: The producePDF method starts the dot process and waits
for it, but it never checks the child exit status, so failures are silent.
Update producePDF to inspect the result of child.waitFor() after launching the
ProcessBuilder and, when the exit code is non-zero, report an error and exit
similarly to the existing exception handling; use the producePDF and child
symbols to locate the change.
In
`@framework/src/main/java/org/checkerframework/framework/stub/AnnotationFileElementTypes.java`:
- Around line 897-898: The jar entry list in AnnotationFileElementTypes is being
sorted twice: once when building entries with
Comparator.comparing(Object::toString) and again later when jarEntryNames is
passed to printSortedIndented. Remove the redundant second sort by reusing the
already-sorted entries list (and the same pattern in the later matching block),
keeping the debug-only output unchanged while avoiding duplicate work.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: fcf92db5-e4d6-47a0-8e26-758bd5d176d2
📒 Files selected for processing (2)
dataflow/src/main/java/org/checkerframework/dataflow/cfg/visualize/CFGVisualizeLauncher.javaframework/src/main/java/org/checkerframework/framework/stub/AnnotationFileElementTypes.java
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
framework/src/main/java/org/checkerframework/framework/stub/AnnotationFileElementTypes.java (1)
921-939: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueSimplify: avoid collecting into a separate list then re-sorting.
entriesis already sorted at line 899, andprintSortedIndentedre-sorts again at line 952. The intermediatejarEntryNamescollection could be built with a stream and directly mapped, skipping the redundant sort logic in this debug-only path.♻️ Optional simplification
- List<String> jarEntryNames = new ArrayList<>(entries.size()); - for (JarEntry jarEntry : entries) { - jarEntryNames.add(jarEntry.getName()); - } - printSortedIndented(jarEntryNames); + printSortedIndented( + entries.stream().map(JarEntry::getName).collect(Collectors.toList()));Behavior is otherwise correct and matches the flush/sleep pattern used elsewhere.
🤖 Prompt for 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. In `@framework/src/main/java/org/checkerframework/framework/stub/AnnotationFileElementTypes.java` around lines 921 - 939, The debug-only jar-entry printing in AnnotationFileElementTypes still builds a separate jarEntryNames list and then re-sorts it via printSortedIndented even though entries is already sorted. Simplify the block inside the stubDebug branch by mapping entries directly to names (for example in the existing loop area) and pass that result to printSortedIndented, or otherwise remove the redundant intermediate collection and extra sort while keeping the existing debug output structure intact.
🤖 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.
Outside diff comments:
In
`@framework/src/main/java/org/checkerframework/framework/stub/AnnotationFileElementTypes.java`:
- Around line 921-939: The debug-only jar-entry printing in
AnnotationFileElementTypes still builds a separate jarEntryNames list and then
re-sorts it via printSortedIndented even though entries is already sorted.
Simplify the block inside the stubDebug branch by mapping entries directly to
names (for example in the existing loop area) and pass that result to
printSortedIndented, or otherwise remove the redundant intermediate collection
and extra sort while keeping the existing debug output structure intact.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: c12a4151-4a03-49cc-a090-23ea2dd502a7
📒 Files selected for processing (1)
framework/src/main/java/org/checkerframework/framework/stub/AnnotationFileElementTypes.java
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
dataflow/src/main/java/org/checkerframework/dataflow/cfg/visualize/CFGVisualizeLauncher.java (1)
328-340: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick winAvoid waiting on unread
dotstreamsProcessBuilderleaves stdout/stderr piped here, but nothing drains them beforewaitFor(). Ifdotwrites enough output or hangs, this can block indefinitely. UseinheritIO()or redirect/drain the streams, and add a timeout if possible.🤖 Prompt for 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. In `@dataflow/src/main/java/org/checkerframework/dataflow/cfg/visualize/CFGVisualizeLauncher.java` around lines 328 - 340, The producePDF method launches dot and then waits without consuming its stdout/stderr, which can deadlock the process if buffers fill. Update producePDF to either call ProcessBuilder.inheritIO() or explicitly redirect/drain the child streams before waitFor, and add a timeout around the process wait if feasible. Keep the fix localized to producePDF and the ProcessBuilder/Process child handling in CFGVisualizeLauncher.
🤖 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.
Outside diff comments:
In
`@dataflow/src/main/java/org/checkerframework/dataflow/cfg/visualize/CFGVisualizeLauncher.java`:
- Around line 328-340: The producePDF method launches dot and then waits without
consuming its stdout/stderr, which can deadlock the process if buffers fill.
Update producePDF to either call ProcessBuilder.inheritIO() or explicitly
redirect/drain the child streams before waitFor, and add a timeout around the
process wait if feasible. Keep the fix localized to producePDF and the
ProcessBuilder/Process child handling in CFGVisualizeLauncher.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 7e856a02-0afb-4a63-ba05-47820401097a
📒 Files selected for processing (1)
dataflow/src/main/java/org/checkerframework/dataflow/cfg/visualize/CFGVisualizeLauncher.java
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
`@framework/src/main/java/org/checkerframework/framework/stub/AnnotationFileElementTypes.java`:
- Around line 933-934: Remove the leftover synchronous-output workaround in
AnnotationFileElementTypes, specifically the System.out.flush() and
SystemPlume.sleep(1) calls near the listing output path. Update the code so the
listing prints directly without any forced flush or pause, and keep the change
localized around the method that emits the output so the in-process behavior
remains clean.
🪄 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: 471612d5-9704-4e15-9003-7e983d16904f
📒 Files selected for processing (1)
framework/src/main/java/org/checkerframework/framework/stub/AnnotationFileElementTypes.java
|
Wait to merge until the next release of plume-util. |
No description provided.