In Eclipse Neon, if I write this Java code:
Stream<Object> stream = Stream.builder().build();
I have no leak warnings, but if I implement Stream
, for example
public class MyStream<T> implements Stream<T> {
}
and I write similar code
Stream<Object> stream = new MyStream<>();
I get a warning Resource leak: 'stream' is never closed
. This only happens in Eclipse, and compiling with javac
no warnings.
Note. I'm not looking for an answer on how to close a thread, etc., but for an answer that explains the reason for this different behavior for the same interface.
source
share