Class StreamElementNotCloseableOrError
A stage whose output element type is closeable (map with makeRes, call, async, a source
of closeables) makes a resource per element, in the middle of a pipeline, where no try can name it and no
statement owns it: the next stage and the sink only ever see a value that nothing closes - or, into a
List of Base, one that is kept after the stream ends. The element type of a stage is not written as a type
argument, so E81061 cannot see it: this asks the type the stream carries, at the source and after each stage, with
the one predicate the ownership rules share (CloseableResourceToBeChecked.isManagedCloseableType(ISymbol)).
Reported ONCE per stream, at the first place the stream carries a closeable element - a stage that merely passes
the same closeable type on (filter, sort) is the same fault, not another one. The fix the message
teaches is a for loop whose body names each value as a try resource.
-
Field Summary
Fields inherited from class RuleSupport
errorListener, symbolsAndScopes -
Constructor Summary
ConstructorsConstructorDescriptionStreamElementNotCloseableOrError(SymbolsAndScopes symbolsAndScopes, ErrorListener errorListener) -
Method Summary
-
Constructor Details
-
StreamElementNotCloseableOrError
StreamElementNotCloseableOrError(SymbolsAndScopes symbolsAndScopes, ErrorListener errorListener)
-
-
Method Details
-
test
- Parameters:
location- the source, or the stage, that produces the element typeproducer- the text of the source or stage (cat,map...)elementType- the type the stream carries after it- Returns:
trueiff the element type is closeable and the error was emitted
-