Skip to content

Java: Assume normal termination in post-dominance. #20163

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

aschackmull
Copy link
Contributor

This is a followup for #19885, which made this possible.

The concept of post-dominance may either assume normal termination of a callable, or try to account for exceptions. This PR switches Java to the former, which is in line with the shared CFG library. Indeed, trying to account for exceptions in post-dominance usually isn't what's desired, and it's also somewhat meaningless, since many potential exception edges are elided in the CFG if there's no enclosing try-block. As such, I'll consider this to be a bug-fix (and a somewhat minor one given that post-dominance is only rarely used).

@aschackmull aschackmull requested a review from a team as a code owner August 4, 2025 13:15
@Copilot Copilot AI review requested due to automatic review settings August 4, 2025 13:15
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR modifies the post-dominance calculation in Java's control flow analysis to assume normal termination rather than accounting for exceptions. The change aligns Java's behavior with the shared CFG library and addresses cases where exception handling in post-dominance analysis can be meaningless due to elided exception edges in the CFG.

  • Updates post-dominance exit node definition to only consider normal exit nodes
  • Excludes exceptional exit paths from post-dominance calculations

@github-actions github-actions bot added the Java label Aug 4, 2025
@aschackmull
Copy link
Contributor Author

I've started dca with the only two queries using post-dominance: java/lazy-initialization (LazyInitStaticField.ql), java/improper-webview-certificate-validation (ImproperWebViewCertificateValidation.ql)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant