RFR: 8057113: (fs) Path should have a method to obtain the filename extension [v18]

Stuart Marks smarks at openjdk.org
Wed Aug 3 22:30:46 UTC 2022


On Mon, 1 Aug 2022 21:54:22 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: Remove API note

src/java.base/share/classes/java/nio/file/Path.java line 262:

> 260:      * is a period character. If the last character is a period character but
> 261:      * some other character is not, then the extension is the
> 262:      * {@linkplain String#isEmpty() empty} string.

> ... or only the first character is a period character.

This needs to be updated to be consistent with the "all leading periods" rule, something like

> ... or all the period characters are leading periods.

Also:

> If the last character is a period character but some other character is not, then the extension is the
> empty string.

I'm not sure what this is trying to say. Is it saying, if the last character is a period, and it is not a leading period, then the extension is empty? If so, then maybe it could say just that; or possibly the statement could be removed since it's a consequence of the definition given earlier.

-------------

PR: https://git.openjdk.org/jdk/pull/8066


More information about the nio-dev mailing list