Skip to content

Add visitArrayAccess to JavaPrinter for marker rendering#7129

Merged
timtebeek merged 1 commit intomainfrom
fix/java-printer-array-access-markers
Mar 24, 2026
Merged

Add visitArrayAccess to JavaPrinter for marker rendering#7129
timtebeek merged 1 commit intomainfrom
fix/java-printer-array-access-markers

Conversation

@steve-aom-elliott
Copy link
Copy Markdown
Contributor

Summary

  • JavaPrinter was missing a visitArrayAccess override, which meant SearchResult markers on J.ArrayAccess nodes were never rendered during printing
  • Every other J node type had an explicit override that called beforeSyntax/afterSyntax (which renders markers), but ArrayAccess fell through to the base JavaVisitor.visitArrayAccess which doesn't call beforeSyntax
  • This prevented taint analysis recipes from marking array access expressions as sinks (e.g., items[taintedIdx])

JavaPrinter was missing a visitArrayAccess override, which meant
SearchResult markers on J.ArrayAccess nodes were not rendered during
printing. Every other J node type had an explicit override that called
beforeSyntax/afterSyntax (which renders markers), but ArrayAccess fell
through to the base JavaVisitor.visitArrayAccess which doesn't call
beforeSyntax.
@github-project-automation github-project-automation bot moved this from In Progress to Ready to Review in OpenRewrite Mar 24, 2026
@timtebeek
Copy link
Copy Markdown
Member

Nice find!

@timtebeek timtebeek merged commit 89ee6c9 into main Mar 24, 2026
1 check passed
@timtebeek timtebeek deleted the fix/java-printer-array-access-markers branch March 24, 2026 23:42
@github-project-automation github-project-automation bot moved this from Ready to Review to Done in OpenRewrite Mar 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working java

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants