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

Store returned by GenericAnnotatedTypeFactory.getStoreAfter() sometimes missing expected variables #3566

Closed
msridhar opened this issue Aug 6, 2020 · 1 comment · Fixed by #3573
Assignees

Comments

@msridhar
Copy link
Contributor

msridhar commented Aug 6, 2020

This issue was observed within the Object Construction Checker. Example:

class Test {
    class Foo {
    }
    Foo makeFoo(){
        return new Foo();
    }
    void test() {
        Foo foo = makeFoo();
    }
}

We are overriding GenericAnnotatedTypeFactory#postAnalyze and analyzing the CFG for test(). Given the AssignmentNode n for Foo foo = makeFoo(), we invoke GenericAnnotatedTypeFactory.getStoreAfter(n) and expect to find an entry in the CFStore for foo. But, foo is missing from the store. Interestingly, if we invoke getAnnotatedType(n.getTree()) we do get the expected type for foo. We would expect this same type to be in the store immediately after the statement.

To reproduce, check out this branch:

https://github.com/msridhar/object-construction-checker/tree/repro-store-bug

And then run:

./gradlew :object-construction-checker:test --tests AlwaysCallTest

The test will fail with a RuntimeException that is thrown when the above case is encountered.

@msridhar
Copy link
Contributor Author

msridhar commented Aug 6, 2020

/cc @Nargeshdb

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