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
Allow for multiple method parameters to be @MustCallAlias in Resource Leak Checker; fixes #4785 #4808
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly looks good! I have a few comments
...ker/src/main/java/org/checkerframework/checker/resourceleak/MustCallConsistencyAnalyzer.java
Outdated
Show resolved
Hide resolved
...ker/src/main/java/org/checkerframework/checker/resourceleak/MustCallConsistencyAnalyzer.java
Outdated
Show resolved
Hide resolved
...ker/src/main/java/org/checkerframework/checker/resourceleak/MustCallConsistencyAnalyzer.java
Outdated
Show resolved
Hide resolved
...ker/src/main/java/org/checkerframework/checker/resourceleak/MustCallConsistencyAnalyzer.java
Outdated
Show resolved
Hide resolved
...ker/src/main/java/org/checkerframework/checker/resourceleak/MustCallConsistencyAnalyzer.java
Show resolved
Hide resolved
...ker/src/main/java/org/checkerframework/checker/resourceleak/MustCallConsistencyAnalyzer.java
Outdated
Show resolved
Hide resolved
...ker/src/main/java/org/checkerframework/checker/resourceleak/MustCallConsistencyAnalyzer.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks mostly good to me; just one more comment. Please re-assign to me once it is addressed.
...ker/src/main/java/org/checkerframework/checker/resourceleak/MustCallConsistencyAnalyzer.java
Show resolved
Hide resolved
...ker/src/main/java/org/checkerframework/checker/resourceleak/MustCallConsistencyAnalyzer.java
Outdated
Show resolved
Hide resolved
…e nor a LocalVariableNode
...ker/src/main/java/org/checkerframework/checker/resourceleak/MustCallConsistencyAnalyzer.java
Outdated
Show resolved
Hide resolved
...ker/src/main/java/org/checkerframework/checker/resourceleak/MustCallConsistencyAnalyzer.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one more comment
...ker/src/main/java/org/checkerframework/checker/resourceleak/MustCallConsistencyAnalyzer.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Went ahead and addressed my final comment. Now looks good to go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, this looks good to me, modulo a few relatively minor comments.
.allMatch( | ||
mustCallAliasArgument -> | ||
mustCallAliasArgument instanceof FieldAccessNode | ||
|| mustCallAliasArgument instanceof ThisNode); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the Checker Framework, the preferred style is to use a loop rather than a stream. Can you rewrite this to use a loop rather than a stream?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
checker/tests/resourceleak/MultipleMethodParamsMustCallAliasTest.java
Outdated
Show resolved
Hide resolved
@kelloggm do you have any further comments on this one? |
… Leak Checker; fixes typetools#4785 (typetools#4808)
… Leak Checker; fixes typetools#4785 (typetools#4808)
Fixes #4785.
In this PR, methods and constructors are allowed to have Multiple @MustCallAlias arguments like:
public @MustCallAlias SequenceInputStream(@MustCallAlias InputStream s1, @MustCallAlias InputStream s2) {...}
If a call has @MustCallAlias annotation, then for each argument passed in the @MustCallAlias position, it creates a set containing the argument and it's resource aliases and add it to the set of obligations. Consider the following example:
SequenceInputStream s3 = new SequenceInputStream(s1, s2)
It creates two sets {s1, s3} and {s2, s3}, and then adds them to the set of obligations.