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

Soundness bug in Resource Leak Checker for type wrapping multiple resources #5453

Closed
msridhar opened this issue Dec 19, 2022 · 0 comments · Fixed by #5461
Closed

Soundness bug in Resource Leak Checker for type wrapping multiple resources #5453

msridhar opened this issue Dec 19, 2022 · 0 comments · Fixed by #5461

Comments

@msridhar
Copy link
Contributor

Example:

@InheritableMustCall({"finish1", "finish2"})
 class TwoOwningMCATest {
   @Owning private final Foo f1 = new Foo();
   @Owning private final Foo f2;
   @MustCallAlias
   TwoOwningMCATest(@MustCallAlias Foo g) {
     this.f2 = g;
   }
   @EnsuresCalledMethods(value="this.f1", methods="a")
   void finish1() {
     this.f1.a();
   }
   @EnsuresCalledMethods(value="this.f2", methods="a")
   void finish2() {
     this.f2.a();
   }
   @InheritableMustCall("a")
   static class Foo {
     void a() {}
   }
 }

The Resource Leak Checker reports no error for the above. But the @MustCallAlias annotations on the constructor are invalid, as satisfying the must-call obligation of the parameter is not sufficient to satisfy the obligations of the newly-created TwoOwningMCATest object.

/cc @kelloggm @Nargeshdb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants