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

Mark Reinhold mr at openjdk.org
Thu Jul 28 16:32:39 UTC 2022


On Wed, 27 Jul 2022 15:30:53 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: Correct length 2 case; update test cases

Changes requested by mr (Lead).

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

> 262:      * representation of the file name after the last dot ('.'). All leading
> 263:      * dots are ignored. If the extension is missing, then an
> 264:      * {@link String#isEmpty() empty} {@code String} ({@code ""}) is returned.

Don’t you mean to say here that if the extension is missing then `null` is returned? That’s what the `@return` tag below implies, and that’s what would be most useful.

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

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


More information about the nio-dev mailing list