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

Resource Leak Checker should not crash when checking the obligations of type variables #4821

Merged
merged 1 commit into from Jul 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -1488,7 +1488,7 @@ private void checkMustCall(
cmAnno =
typeFactory
.getAnnotatedType(alias.reference.getElement())
.getAnnotationInHierarchy(typeFactory.top);
.getEffectiveAnnotationInHierarchy(typeFactory.top);
}

if (calledMethodsSatisfyMustCall(mustCallValue, cmAnno)) {
Expand Down
3 changes: 2 additions & 1 deletion checker/tests/resourceleak/Issue4815.java
@@ -1,12 +1,13 @@
// Test case for https://tinyurl.com/cfissue/4815
// @skip-test until the bug is fixed.

import java.util.List;
import org.checkerframework.checker.mustcall.qual.MustCall;
import org.checkerframework.checker.mustcall.qual.Owning;

public class Issue4815 {
public <T extends Component> void initialize(
// This error is a false positive, so if the checker stops finding it that would be fine.
// :: error: (required.method.not.called)
List<T> list, @Owning @MustCall("initialize") T object) {
object.initialize();
list.add(object);
Expand Down