Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8083999 | emb-9 | Stuart Marks | P5 | Resolved | Fixed | team |
The specification for Files.lines(Path, Charset) mentions that it contains a reader and talks about how it should be used with try-with-resources. The wording is:
The returned stream encapsulates a Reader. If timely disposal of file system resources
is required, the try-with-resources construct should be used to ensure that the stream's
close method is invoked after the stream operations are completed.
The specification for Files.lines(Path) doesn't mention anything about this at all.
It would be better if the wording were simplified and strengthened. Suggestion:
The returned stream contains an open file. This method must be used within a
try-with-resources statement to ensure that the file is closed promptly after the
stream operations are completed.
The same statement should appear in both overloads of Files.lines().
This might be an @apiNote.
The returned stream encapsulates a Reader. If timely disposal of file system resources
is required, the try-with-resources construct should be used to ensure that the stream's
close method is invoked after the stream operations are completed.
The specification for Files.lines(Path) doesn't mention anything about this at all.
It would be better if the wording were simplified and strengthened. Suggestion:
The returned stream contains an open file. This method must be used within a
try-with-resources statement to ensure that the file is closed promptly after the
stream operations are completed.
The same statement should appear in both overloads of Files.lines().
This might be an @apiNote.
- backported by
-
JDK-8083999 (fs) Files.lines documentation needs clarification
-
- Resolved
-