RFR: 8298318: (fs) APIs for handling filename extensions [v2]

Louis Bergelson duke at openjdk.org
Thu Mar 7 20:11:00 UTC 2024


On Mon, 20 Nov 2023 23:30:45 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> Add to `java.nio.file.Path` a method `getExtension` to retrieve the `Path`'s extension, and companion methods `removeExtension` and `addExtension`.
>
> Brian Burkhalter has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:
> 
>  - 8298318: Correct type in path.getExtension spec
>  - Merge
>  - 8298318: (fs) APIs for handling filename extensions

I like the idea of adding extension manipulation methods to Path.  From my experience, this is an extremely common source of silly bugs.  

This is very useful for filesystems that have complications around the file name.  Things like http urls with query parameters are a consistent source of bugs due to people implementing naive handling of extensions.  Letting the individual Path implementation decide what part is the extension would be very helpful.

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

PR Comment: https://git.openjdk.org/jdk/pull/16226#issuecomment-1939344986


More information about the nio-dev mailing list