error-prone icon indicating copy to clipboard operation
error-prone copied to clipboard

MustBeClosedChecker Mockito matcher is missing some cases that should be suppressed

Open rwinograd opened this issue 3 years ago • 0 comments

Assuming that we have the following code:

class SomeClass {
  @MustBeClosed
  Closeable someMethod() {
    return new AutoCloseable() {
       public void close() {};
    };
  }
}

Two examples of code that are still being flagged by the checker are:

SomeClass instance = new SomeClass();
Mockito.lenient().when(instance).someMethod();
SomeClass instance = new SomeClass();
Mockito.verify(instance).someMethod();

rwinograd avatar Jul 28 '22 17:07 rwinograd