Skip to content
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

Make nodes for switch expressions appear on their own in the containing CFG block #4979

Closed
msridhar opened this issue Dec 10, 2021 · 2 comments · Fixed by #4982
Closed

Make nodes for switch expressions appear on their own in the containing CFG block #4979

msridhar opened this issue Dec 10, 2021 · 2 comments · Fixed by #4982

Comments

@msridhar
Copy link
Contributor

I'm working on getting NullAway to not crash in the presence of switch expressions, now that Checker dataflow does not crash for them. One small issue is that the marker node for a switch expression may not appear as a top-level node in the containing CFG block, so it never gets directly visited by the dataflow analysis. If I have a statement Object o = null;, I get four nodes in the corresponding CFG basic block: a VariableDeclarationNode, a NullLiteralNode, an AssignmentNode, and a LocalVariableNode. But, if I write Object o = switch (i) { ... };, I just get three nodes in the corresponding block: a VariableDeclarationNode, an AssignmentNode, and a LocalVariableNode; the marker node for the switch expression is missing.

I imagine the representation of switch expressions in CFGs is very temporary, and as it gets handled it will get its own node in the containing block for cases like these. And I can add a special case to work around this for now. Just wanted to note the issue.

@msridhar
Copy link
Contributor Author

Update: given that switch expressions aren't yet properly represented in the CFG anyway, this issue doesn't really matter to us. If it's of no value it can just be closed.

@smillst
Copy link
Member

smillst commented Dec 10, 2021

I'm actively working on adding support for analyzing switch expressions, so this should be fixed soon.

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 a pull request may close this issue.

2 participants