Hi,
this rule has a default severity of "blocker" and it flags uses of java.util.Stream if it's not closed.
However the javadoc for Stream states:
Streams have a close()
method and implement AutoCloseable
, but nearly all stream instances do not actually need to be closed after use. Generally, only streams whose source is an IO channel (such as those returned by Files.lines(Path, Charset)
) will require closing. Most streams are backed by collections, arrays, or generating functions, which require no special resource management. (If a stream does require closing, it can be declared as a resource in a try
-with-resources statement.)
I think this rule needs a way to add exceptions (so that Stream can be excluded), or maybe there should be a separate rule for java.util.Stream with a lower default severity.