RFR: 8057113: (fs) Path should have a method to obtain the filename extension [v16]
Mark Reinhold
mr at openjdk.org
Fri Jul 29 17:30:58 UTC 2022
On Thu, 28 Jul 2022 23:12:32 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
>> Resurrection of the proposal to add a method to obtain the filename extension originated in PR [2319](https://github.com/openjdk/jdk/pull/2319).
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
>
> 8057113: Update specification, implementation, and test
Changes requested by mr (Lead).
src/java.base/share/classes/java/nio/file/Path.java line 261:
> 259: /**
> 260: * Returns the file name extension of this path as a {@code String}. The
> 261: * extension is defined to be the portion of the
Omit "defined to be"; it's redundant.
src/java.base/share/classes/java/nio/file/Path.java line 262:
> 260: * Returns the file name extension of this path as a {@code String}. The
> 261: * extension is defined to be the portion of the
> 262: * {@link #getFileName file name} string after the last dot ('.'). All
`{@linkplain #getFileName file name}`
src/java.base/share/classes/java/nio/file/Path.java line 263:
> 261: * extension is defined to be the portion of the
> 262: * {@link #getFileName file name} string after the last dot ('.'). All
> 263: * leading dots in the string are ignored. If the extension is missing,
Simplify `All leading` to `Leading`.
Change `the extension is missing` (which suggests an error) to `there is no extension`.
src/java.base/share/classes/java/nio/file/Path.java line 268:
> 266: * string does not contain a dot, or only the first character is a dot.
> 267: * If the last character is a dot but some other character is not, then
> 268: * the extension is the {@link String#isEmpty() empty} string.
The term "dot" is imprecise. Consider saying `period character ('.', U+002E FULL STOP)` on first use (to be consistent with [other specifications][jlc]), and `period character` thereafter.
[jlc]: https://docs.oracle.com/en/java/javase/18/docs/api/java.base/java/lang/Character.html#isWhitespace(char)
-------------
PR: https://git.openjdk.org/jdk/pull/8066
More information about the nio-dev
mailing list