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

Assertion of not equal to null updates the access path #240

Merged
merged 3 commits into from
Oct 12, 2018

Conversation

shubhamugare
Copy link
Contributor

Added support for assert statements that check if the left operand is not equal to null. It will be assumed that the operand is NONNULL, and warnings will change accordingly.

Fixes #122
Added unit tests

@CLAassistant
Copy link

CLAassistant commented Oct 10, 2018

CLA assistant check
All committers have signed the CLA.

Copy link
Collaborator

@msridhar msridhar left a comment

Choose a reason for hiding this comment

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

Overall this looks great, thanks! We just need a couple of comments to be addressed.

@@ -114,7 +114,7 @@ public ControlFlowGraph load(CfgParams key) {
codePath.getLeaf(), (ClassTree) codePath.getParentPath().getLeaf());
bodyPath = codePath;
}
return CFGBuilder.build(bodyPath, ast, false, false, env);
return CFGBuilder.build(bodyPath, ast, true, false, env);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I thought we agreed that there would be a command-line flag controlling whether we treat assertions as being on or not?

Copy link
Collaborator

@msridhar msridhar left a comment

Choose a reason for hiding this comment

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

Looks great now! Just one more minor comment

@@ -63,6 +63,8 @@
*/
private static final int MAX_CACHE_SIZE = 50;

private boolean assertsEnabled;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's make this final, initialize in the constructor, and get rid of the setAssertionsEnabled() method

Copy link
Collaborator

@msridhar msridhar left a comment

Choose a reason for hiding this comment

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

LGTM, will land

@msridhar msridhar merged commit 81030b5 into uber:master Oct 12, 2018
@msridhar
Copy link
Collaborator

Thanks for the contribution @shas19!

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.

3 participants